WASHINGTON — The Supreme Court struck down two North Carolina congressional districts on Monday, ruling that lawmakers had violated the Constitution by relying too heavily on race in drawing them, in a decision that could affect many voting maps, generally in the South.

The decision was handed down by an unusual coalition of justices, and was the latest in a series of setbacks for Republican-led legislatures. In recent cases concerning legislative maps in Alabama and Virginia, as well, the Supreme Court has insisted that packing black voters into a few districts — which dilutes their voting power — violates the Constitution.

Republicans in the North Carolina legislature denied that race was the predominant factor in redrawing the boundaries of the two districts under review. In one of them, though, they said, they had made some use of race.

The lawmakers said they had tried to comply with the Voting Rights Act, which in some settings requires that black voters be concentrated in numbers sufficient to provide them with an opportunity to elect their preferred candidates. But critics of the voting map said the legislature was actually trying to diminish the number of districts in the state that could be won by Democrats.