JEFFERSON CITY, Mo. (AP) — The Missouri Supreme Court upheld the state's new congressional districts Friday, finally providing certainty for candidates who have been campaigning for the August primary elections without knowing whether certain counties, cities or neighborhoods ultimately would be in their districts.

A divided high court ruled Friday that the eight new U.S. House districts comply with a constitutional requirement that they be "as compact ... as may be." The ruling solidifies the district boundaries enacted last year when the Republican-led Legislature — with the help of a few Democrats — overrode a veto by Democratic Gov. Jay Nixon.

Although some Supreme Court judges dissented, a majority determined that the Missouri Constitution "does not require absolute precision in compactness." The Supreme Court ultimately deferred to a February decision by Cole County Circuit Judge Dan Green, declaring that it was not going to substitute its own judgment for the trial court's when it came to disputed factual issues about the boundaries.

Missouri lawmakers had to redraw the state's nine current congressional districts into eight new districts after the 2010 census, because Missouri's population growth lagged behind that of some other states. The new congressional district map also had to account for population shifts within the state, such as a continued exodus of residents from St. Louis to its outer suburbs.

Two separate lawsuits challenged the new map. One focused largely on the Kansas City area, where the 5th District was extended from Jackson County to also cover rural Lafayette, Ray and Saline counties — forming a shape that some said resembled a dead lizard. A chunk of Jackson County, meanwhile, was carved out and added to the 6th District, which stretches across northern Missouri from Nebraska to Illinois.

In addition to the Kansas City area, the other lawsuit had pointed to the new 3rd District, which runs from central Missouri eastward with arms touching the Mississippi River both north and south of St. Louis. Some had called that district the lobster claw. That second lawsuit also had raised concerns about the 4th District in west-central Missouri and the 7th District in southwestern Missouri.