A California judge scolded the state’s attorney general this week for writing a tax-related ballot question that was “flawed” and potentially “misleading” to voters – so much so that the judge rewrote the ballot question himself.

The ballot measure is on repealing the state’s gas tax increases. Democratic state Attorney General Xavier Becerra’s title, though, had downplayed the word “tax,” saying instead the measure “eliminates recently enacted road repair and transportation funding by repealing revenues dedicated for those purposes.”

Sacramento County Superior Court Judge Timothy Frawley has now issued a rewrite of the title.

"This is not a situation where reasonable minds may differ," Frawley wrote. "The attorney general's title is fundamentally flawed and must be changed to avoid misleading the voters and creating prejudice against the measure."

The judge finalized the question following a lawsuit from Assemblyman Travis Allen, a Republican candidate for governor who wants to repeal the gas tax.

The new question reads: "Repeals recently enacted gas and diesel taxes and vehicle registration fees. Eliminates road repair and transportation programs funded by these taxes and fees."

The lawsuit had alleged that the title written by Becerra was misleading to voters. According to court documents, Allen’s original title said that measure “repeals recent legislation that created new gas tax, diesel tax, vehicle registration fee and zero-emission vehicle fee.” The state attorney general later issued the new version.

According to the documents, the attorney general's office argued their summary clearly informed voters that the measure would repeal taxes.

But the court said the title and summary together created confusion about what would be repealed.

Becerra was appointed by California Gov. Jerry Brown to succeed Kamala Harris after her election to the U.S. Senate.

“Unfortunately, Becerra has undermined the law and the integrity of his office to purse a narrow, partisan political agenda to block the taxpayer’s right to decide on the gas tax,” Allen wrote in an op-ed for the Sacramento Bee ahead of the court’s decision.

The ballot measure was introduced by Allen in response to a law increasing gas taxes and vehicle fees signed by Brown earlier this year.

Lawmakers voted in April to boost gas taxes and vehicle fees to raise $5 billion a year for road repairs. Starting Nov. 1, gas taxes will increase by 12 cents a gallon and diesel taxes by 20 cents.

Next year, a new fee tied to vehicle registrations will cost motorists between $25 and $175 depending on the value of the vehicle.

The ballot title and summary will appear on petition forms and the ballot if it qualifies. It must be finalized before Allen and his allies can begin collecting signatures in an attempt to put the repeal bill on the November 2018 ballot.

Allen said he was pleased with the judge's final language, which he said would make clear to voters what they're deciding.

"By rewriting it himself, he has entirely taken partisanship out of the ballot initiative process just as the California constitution intended," Allen said.

The Associated Press contributed to this report.