WASHINGTON — The Supreme Court unanimously ruled on Monday that states may count all residents, whether or not they are eligible to vote, in drawing election districts. The decision was a major statement on the meaning of a fundamental principle of the American political system, that of “one person one vote.”

“We hold, based on constitutional history, this court’s decisions and longstanding practice, that a state may draw its legislative districts based on total population,” Justice Ruth Bader Ginsburg wrote for the court.

As a practical matter, the ruling mostly helped Democrats and upheld the status quo.

But until this decision, the court had never resolved whether voting districts should contain roughly the same number of people or the same number of eligible voters. Counting all people amplifies the voting power of places that have large numbers of residents who cannot vote legally — including immigrants who are here legally but are not citizens, illegal immigrants and children. Those places tend to be urban and to vote Democratic.

Had the justices required that only eligible voters be counted, the ruling would have shifted political power from cities to rural areas, a move that would have benefited Republicans.