In the Illyrian Wars of 229 BC and 219 BC, Rome overran the Illyrian settlements in the Neretva river valley and suppressed the piracy that had made the Adriatic unsafe. In 180 BC, the Dalmatians declared themselves independent of the Illyrian king Gentius, who kept his capital at Scodra. The Romans defeated Gentius, the last king of Illyria, at Scodra in 168 BC and captured him, bringing him to Rome in 165 BC.