BOSTON (AP) — Massachusetts voters have voted against repealing a new law allowing immigrants who are in the country illegally to obtain state driver’s licenses.

The measure became law after the Democrat-controlled Massachusetts House and Senate overrode a veto by Republican Gov. Charlie Baker in June. Republicans pushed the ballot question to repeal the law. Voters opted instead to keep it by approving Question No. 4 on the ballot.

Under the new law, people in the country illegally will be able to apply for a driver’s license if they can provide the Registry of Motor Vehicles with a foreign passport or consular identification document.

They will also have to provide one of five additional documents: a driver’s license from another U.S. state or territory; a birth certificate; a foreign national identification card; a foreign driver’s license; or a marriage certificate or divorce decree from any U.S. state or territory.

The law was a win for immigrant rights groups that had long pushed for the measure, framing it in part as a public safety measure. They said that under the law those seeking licenses will have to show they can properly operate a car and get insurance for their car in the event of a crash.

Critics, including outgoing Republican Gov. Charlie Baker and GOP candidate for governor Geoff Diehl, said the law could make it easier for those in the country illegally to be able to vote. Diehl and the state Republican party helped lead the effort to repeal the law. Supporters say the law takes steps to guard against illegal voting.

The new law is set to take effect July 1, 2023. Massachusetts will join 16 other states and the District of Columbia that have similar laws.

Another hotly contested ballot question in Massachusetts — one that would create a tax aimed at millionaires — remained too early to call early Wednesday.

Ballot question No. 1 would add an amendment to the state constitution imposing a 4% surtax on the portion of an individual’s annual income that exceeds $1 million.

Those making up to $1 million, but not exceeding that amount, wouldn't pay new taxes.

Supporters — including labor unions, community organizations and religious groups — have argued that the new tax would generate about $2 billion in annual revenue that could be used for education and transportation.

Opponents, including business groups, warned the measure could end up costing jobs and driving away some of the state’s wealthiest citizens.

The state’s constitution currently requires all income be taxed at uniform rates. The $1 million threshold would be adjusted each year to reflect cost-of-living increases.

Voters split on two other questions on the ballot.

Question No. 2, which was approved Tuesday, would regulate dental insurance rates, including requiring companies to spend at least 83% of premiums on member dental expenses and quality improvements instead of administrative expenses, and by making other changes to dental insurance regulations.

Voters rejected Question No. 3, which would have increased the number of licenses a retailer could have for the sale of alcoholic beverages to be consumed off premises, limit the number of “all-alcoholic beverages” licenses a retailer could acquire, restrict use of self-checkout, and require retailers to accept customers’ out-of-state identification.