Three months after Maryland lawmakers raised taxes on the wealthy, saying the money was urgently needed for classrooms, surging revenue from other areas has left the state with a surplus, prompting a fight about whether the tax increase was needed at all.

Maryland ended its budget year with over a half-billion dollars in the bank — or more than twice as much as expected, Comptroller Peter Franchot (D) announced late last week.

Money from the income-tax hike — Maryland’s first in five years — accounted for nearly half of that. State lawmakers had planned to carry most of the new tax revenue forward to help with future shortfalls. But with higher-than-expected revenue doubling the state’s financial cushion, some officials charged Friday that Gov. Martin O’Malley (D) and Democratic legislative leaders hypedtalk of budget cuts to get the General Assembly to approve the tax increase.

“It’s clear the ‘doomsday’ budget was always a gimmick to stampede legislators into voting for tax increases and a gambling expansion. They were contrived crises,” Franchot said of the legislature’s two special sessions.

The first, in May, resulted in the tax increase. The second, in August, produced a ballot measure to allow a casino in Prince George’s County.

“The balance shows, absolutely, the tax increases were not needed,” said state Sen. C. Anthony Muse (D-Prince George’s). Muse was one of a handful of Democrats who voted in May against the quarter-percentage-point tax increase on six-figure earners. He alsoopposed the casino.

“What happens now? I can guarantee we won’t go back and say, ‘Gee, Marylanders, we were wrong, we’re going to rescind the tax,’ ” Muse said. “No, it’ll be spent.”

Democratic leaders in the General Assembly and a spokeswoman for O’Malley pushed back strongly against the criticism. They said that ending the year further in the black than expected only showed that the state had been conservative in its budgeting and that the additional tax money would be put to good use next year to help close an ongoing structural shortfall.

In the budget year beginning next summer, the state faces an expected gap of $712 million between revenue and formula-driven spending increases for education, health care and other costs. The projected gap remains about $500 million annually thereafter.

O’Malley and Democrats who control the General Assembly have closed larger budget holes, usually in excess of $1 billion annually since the start of the recession, by holding spending in some departments at or near levels from previous years while letting overall spending rise, mostly with increased borrowing.

With the surplus, O’Malley could face a budget gap significantly smaller than at any time since his first year in office.

“We cannot look several months into the future when we put together our budget and predict outcomes. Would be great if we could but reality is that we can’t,” O’Malley spokeswoman Raquel Guillory said in an e-mail. “These numbers represent sound fiscal policies and a balanced approach to cuts and investments.”

At a minimum, however, Maryland’s relatively flush year-end balance of $550 million has renewed questions about whether election-year politics factored in the decision to push for a tax increase this year.

As a surrogate for President Obama, O’Malley has repeatedly touted the state’s tax increase on high-income earners as an example of Democrats’ “balanced approach” to budgeting that could be seen nationally with an Obama reelection.

About 14 percent of tax filers — single earners with income in excess of $100,000 and joint-filers reporting more than $150,000 — saw their Maryland tax rates jump a quarter of a percentage point, retroactive to Jan. 1.

The change put Maryland’s new top state-local tax bracket alongside the District’s as fourth-highest nationwide, at 8.95 percent. Across the Potomac, the top rate in Virginia is 5.75 percent.

For state lawmakers, who are up for reelection in 2014, passing an income-tax increase in one of O’Malley’s remaining two years in office would havebeen increasingly difficult.

Senate Minority Leader E.J. Pipkin (R-Queen Anne’s) accused O’Malley of driving the tax increase to better position himself to win the Democratic Party’s presidential nomination in 2016.

“There was never a need for a tax increase. This was all about pandering to the teachers unions. Special-interest politics at its worst,” Pipkin said.

Tax increases have fomented grass-roots opposition, giving rise to a group called Change Maryland, which has had 22,000 Facebook followers since the spring.

“It hasn’t been just one tax increase — there have been 24 tax and fee increases” under O’Malley, said the site’s founder, Larry Hogan, a member of the Cabinet of former governor Robert L. Ehrlich (R). Hogan noted that Maryland’s $35.5 billion budget would have increased over $600 million even before the tax increase.

“Only in Annapolis could you make the case that increasing the budget would be a ‘doomsday,’ ” Hogan said.

Del. John L. Bohanan Jr. (D-St. Mary’s), who chairs the assembly’s spending affordability committee, said Maryland should be lauded for prudent budgeting and a surplus that may indicate state revenue and the economy are turning around.

“The critics are the same ones who said we were being irresponsible for not building more surplus into the budget. They didn’t think we built in enough cushion,” he said, referring to Republicans who criticized the spending plan during debate on the House floor in May. “Now that it turns out we did, they seem to be saying something else.

“We’re optimistic the [surplus] shows the economy has begun to turn around.”

Franchot, however, said sales tax revenue tapered off in June. He warned lawmakers not to spend the surplus. It should be put aside, he said, in case federal spending ramps down, the economy constricts and Maryland’s shortfall grows next year.