San Francisco this week began allowing undocumented immigrants to register to vote in school board races, following a handful of other municipalities that have opened up local elections to noncitizens — and it has become an issue in the California governor's race.

Only U.S. citizens can vote in federal and state elections, both in San Francisco and around the country. But there are some places that have carved out a role for noncitizens in local races.

The new provision in San Francisco, which voters approved in a 2016 referendum, expires after 2022 unless the city decides to extend it. Noncitizens, including those without legal status, can vote only in school board races and only if they are parents, legal guardians, or caregivers to children under the age of 19.

The new measure also has become a topic in the race for governor in California. Adam Putnam, the GOP candidate for governor, criticized both San Francisco and Takoma Park in a tweet this week for "allowing illegals to vote."

"The right to vote should not be allowed or practiced by anyone who was not born in our country or who has not taken the necessary, legally required steps to become a citizen of our nation,” he wrote in an op-ed article last year. "This right is too precious to grant to those who have not earned it."

In San Francisco, newly eligible voters who are not citizens use a separate form to register that includes a printed warning that their information will be accessible by Immigration and Customs Enforcement (ICE) and recommending that they consider consulting an immigration attorney before signing up. That could potentially deter households with undocumented immigrants from participating, even if eligible.

A man wears a "I Voted!" sticker in multiple languages after voting in the California primary on June 7, 2016, at City Hall in San Francisco. Andrew Burton / Getty Images file

Proponents argued that expanding school board elections to non-citizens made sense given estimates that about one-third of children in the school system have foreign-born parents.

Some advocates also explicitly tied the measure to broader concerns surrounding the treatment of immigrants.

Democratic Assemblyman David Chiu argued in an op-ed article before the 2016 vote on the measure that its passage would send a message to then-candidate Donald Trump — "the most anti-immigrant bigot nominated by a major political party in recent American history," he said — that immigrants are valued in their community.

Other local governments have engaged in broader experiments with noncitizen voting. Takoma Park, Maryland, opened up its elections to noncitizens over two decades ago and some neighboring communities have since followed suit. One of the leading local politicians who advocated for the Takoma Park change, Jamie Raskin, is now the area's congressman.

Greg Siskind, an immigration lawyer in Tennessee, told NBC News that localities that allow noncitizen voting should be careful to minimize the chances people accidentally try to register for state or federal elections, which could open them up to prosecution.

"It's nice that it gives people a voice in a community, but if they try to vote in a federal election they can be deported," Siskind said. "There needs to be some education happening to make sure they understand the difference."