House Democrats voted Friday to defend localities that allow illegal immigrants to vote in their elections, turning back a GOP attempt to discourage the practice.

The vote marks a stunning reversal from just six months ago, when the chamber — then under GOP control — voted to decry illegal immigrant voting.

“We are prepared to open up the political process and let all of the people come in,” Rep. John Lewis, a Georgia Democrat and hero of the civil rights movement, told colleagues as he led opposition to the GOP measure.

QUIZ: US Citizenship Test - Could You Pass?

The 228-197 vote came as part of a broader debate on Democrats’ major legislative priority this year, HR 1, the “For the People Act,” which includes historic expansions of voter registration and access, as well as a major rewrite of campaign finance laws.

The measure would have had no practical effect even if it had passed. Illegal immigrants — and indeed noncitizens as a whole — are not legally able to participate in federal elections.

But Republicans had hoped to send a message to localities such as San Francisco, where noncitizens are now allowed to vote in school board elections.

QUIZ: US Citizenship Test (Part II) -- could you pass?

“It sounds like I’m making it up. What kind of government would cancel the vote of its own citizens, and replace it with noncitizens?” said Rep. Dan Crenshaw, Texas Republican.

He pointed to last year’s vote, when 49 Democrats joined the GOP to decry noncitizen voting.

On Friday just six Democrats voted in favor.

A 1996 federal law prohibits noncitizens from voting in federal elections, but there is no prohibition on localities, and indeed a number of jurisdictions allow it, to some extent.

Famously liberal Takoma Park, a small jurisdiction in Maryland, has for several decades allowed noncitizens, including illegal immigrants, to vote in local elections.

Experts say as many as 40 states or territories allowed noncitizen voting dating back to the nation’s founding.

San Francisco in July began allowing noncitizens to vote in school board elections — though they must be parents or legal guardians of students.