SACRAMENTO — After months of dire warnings and a week of round-the-clock arm-twisting, Gov. Arnold Schwarzenegger this afternoon signed a $41 billion budget package of steep tax increases and spending cuts. That simple act capped a drawn-out drama to keep the state from going broke.

There is something in the package sure to offend nearly everyone: fed-up voters, tax-averse conservatives, labor unions, environmentalists, educators and local officials worried about how to keep the fraying social safety net from snapping.

The deal also could end the political careers of the handful of Republican legislators who joined fractious Democrats to vote “aye” as the sun rose Thursday.

In a statement released immediately after he formally signed the budget just before 2 pm, Schwarzenegger said: “We have achieved a great victory for California today. During a down economy and facing an historic budget deficit, we had to make some very difficult decisions, but I am very proud that California is back on the best path forward.”

But on Thursday, even as he thanked the Legislature for its “difficult but courageous” vote, the governor acknowledged that much remained to be done. “Our work is not over,” he said, referring to a soon-to-be launched campaign to pass ballot measures that were tied to the budget vote.

The three-month standoff halted funding for public works projects across California, delayed refunds for millions of taxpayers, forced unpaid furloughs on thousands of state workers and caused the state’s credit rating to be downgraded, rendering it virtually unable to borrow money.

The breakthrough, after more than five days of sometimes round-the-clock negotiations in the Legislature, came about 1 a.m. Thursday, when top Senate Democrats agreed to GOP Sen. Abel Maldonado’s demands in exchange for his deciding vote. Among them: ballot measures that would do away with partisan primaries and block pay raises for lawmakers when the state is running a deficit.

Maldonado, a moderate Republican whose district includes parts of Silicon Valley, also forced through a last-minute agreement to trim the package’s tax hikes to $12.8 billion by eliminating a 12-cents-a-gallon excise on gasoline; the difference will be made up with California’s share of federal economic stimulus money and with expected line-item vetoes by Schwarzenegger.

One Assembly member called the deal “blackmail, extortion and skulduggery.” Another labeled it “political ransom.” Senate President Pro Tem Darrell Steinberg, D-Sacramento — who Tuesday had ordered that legislators be locked inside the Capitol building until they forged a deal — at one point ordered recalcitrant Democrats into his office one by one to try to win their cooperation.

Open primaries

Even so, when the Senate resumed session about 3:40 a.m., four Democrats initially refused to vote for Maldonado’s open-primary measure, which will be put before voters in June 2010. Advocates say the proposal could break partisan deadlock by giving more power to moderate voices, but both parties fear it could endanger safe seats. The idea has been shot down twice in California in the past decade: once by the U.S. Supreme Court and, more recently, in 2004, when voters rejected Proposition 62.

Sen. Gloria Romero, D-Los Angeles, was near tears as she called her party’s capitulation to Maldonado “a disgusting process.” Yet she, like the other holdouts, changed her vote to yes, and the Senate approved the open-primary measure just before 5 a.m.

The state Assembly passed the measure at 6:30 a.m. Assembly GOP leader Mike Villines of Fresno, Roger Niello of Sacramento and Anthony Adams of Claremont provided the three Republican votes needed to put the budget over the two-thirds threshold.

Mere hours after the vote, Adams was targeted by a conservative group that vowed to mount a recall campaign against him.

Yet bleary-eyed lawmakers traded smiles and hugs when the more than two dozen bills in the budget package had finally passed, and the state’s historic standoff came to an end.

Tax refunds and billions of dollars in other payments that had been held up because the state could not cover the checks will soon be on track to be released. State Controller John Chiang’s office is awaiting the state Department of Finance to provide details of the budget, which are expected in about a week, before determining when payments can resume

$1 billion reserve

The budget is intended to close a projected $40 billion deficit through mid-2010 and establish a $1 billion rainy-day reserve. The plan includes a 1-cent-on-the-dollar sales tax hike, increased income taxes, deep cuts to education and social services and fast-tracked environmental review for some state construction projects. Also tucked in was a controversial tax break that benefits the high-tech and biotech industries — sure to be a boon for Silicon Valley.

Besides the ballot measures agreed to at Maldonado’s behest, parts of the plan depend on other measures voters will be asked to approve in a special election in May. One would seek to expand the state lottery and borrow $5 billion against the increased revenue. Another would impose a cap on state spending of roughly 4 percent to 6 percent annually.

If voters approve the spending limit, most of the taxes would last for four years. If it fails, the taxes would expire after two years.

The overall budget deal involved major trade-offs for both parties that they would never have agreed to absent the state’s financial crisis.

“I don’t think anybody’s happy with this,” said Sen. Denise Moreno Ducheny, D-Chula Vista, ﻿”other than we get to go home and sleep.”

Contact Mike Zapler at mzapler@mercurynews.com or (916) 441-4603.