WASHINGTON — Perilously close to a government shutdown, President Barack Obama and congressional leaders forged agreement late Friday night on a deal to cut about $38 billion in federal spending and avert the first closure in 15 years.
Obama hailed the deal, a bit more than an hour before a midnight deadline, as “the biggest annual spending cut in history,” and House Speaker John Boehner said that over the next decade it would cut government spending by $500 billion.
“This is historic, what we’ve done,” said the third man in the talks, Senate Majority Leader Harry Reid, D-Nev.
They announced the agreement less than an hour before government funding was due to run out. The shutdown would have closed national parks, tax-season help lines and other popular services, though the military would have stayed on duty and other essential efforts such as air traffic control would have continued in effect.
On side issues — “riders,” the negotiators called them — the Democrats and the White House rebuffed numerous Republican attempts to curtail the reach of the Environmental Protection Agency and sidetracked their demand to deny federal funds to Planned Parenthood.
Anti-abortion lawmakers did succeed in winning a provision to ban the use of federal or local government funds to pay for abortions in the District of Columbia.
Racing to beat the deadline, lawmakers worked to pass an interim measure to prevent a shutdown, however brief, and keep the federal machinery running for the next several days.
The Senate acted within minutes, and House members were called into session to follow suit as midnight neared.
“I am pleased congressional leaders found a bridge that enables us to avert a shutdown. That we are even in this situation is beyond unfortunate — it indicates the dysfunctional nature of our budget process,” said Sen. Olympia Snowe, R-Maine.
“It shouldn’t have come to such a late hour, but I’m glad that actions were taken to avoid a costly shutdown. I look forward to reviewing the details of the longer term budget agreement as we move forward,” said Rep. Mike Michaud, D-Maine.
The deal came together after six grueling weeks and an outbreak of budget brinksmanship over the past few days as the two sides sought to squeeze every drop of advantage in private talks.
A shutdown threatened to affect millions of people, endanger the recovery of the economy and embarrass the administration and Congress. The developments unfolded as the administration readied hundreds of thousands of furlough notices for federal workers.
The deal will cut billions of dollars in spending through Sept. 30, the end of the budget year.
“We know the whole world is watching us today,” said Reid during a day that featured incendiary, campaign style rhetoric as well as intense negotiation.
Earlier in the evening, Boehner indicated his own optimism about a deal, telling reporters, “I was born with a glass half full.”
Reid, Obama and Boehner all agreed a shutdown posed risks to an economy still recovering from the worst recession in decades.
But there were disagreements aplenty among the principal players in an early test of divided government — Obama in the White House, fellow Democrats in control in the Senate and a new, tea party-flavored Republican majority in the House.
“Republican leaders in the House have only a few hours left to look in the mirror, snap out of it and realize how positively shameful that would be,” Reid said at one point, accusing Republicans of risking a shutdown to pursue a radical social agenda.
For much of the day, Reid and Boehner disagreed about what the disagreement was about.
Reid said there had been an agreement at a White House meeting Thursday night to cut spending by about $38 billion. He said Republicans also were demanding unspecified cuts in health services for lower income women that were unacceptable to Democrats.
“Republicans want to shut down our nation’s government because they want to make it harder to get cancer screenings,” he said. “They want to throw women under the bus.”
Boehner said repeatedly that wasn’t the case — it was spending cuts that divided two sides.
“Most of the policy issues have been dealt with, and the big fight is about spending,” he said. “When will the White House and when will Senate Democrats get serious about cutting federal spending.”
By midday Friday, 12 hours before the funding would run out, most federal employees had been told whether they had been deemed essential or would be temporarily laid off in the event of a shutdown.
The military, mail carriers, air traffic controllers and border security guards would still be expected at work, although paychecks would have been delayed.
National parks and forests would close, and taxpayers filing paper returns would not receive refunds during a shutdown.
Passports would be available in cases of emergencies only.
Obama canceled a scheduled Friday trip to Indianapolis — and a weekend family visit to Colonial Williamsburg in Virginia — and kept in touch with both Boehner and Reid.
Senate Republican Leader Mitch McConnell of Kentucky sounded hopeful, predicting an agreement and saying, “I assure you, these are not unresolvable issues.”
The House passed legislation on Thursday to keep the government running for another week while also cutting $12 billion in spending — and providing enough money for the Pentagon to operate through Sept. 30.
The standoff began several weeks ago, when the new Republican majority in the House passed legislation to cut $61 billion from federal spending and place numerous curbs on the government.
In the weeks since, the two sides have alternately negotiated and taken time out to pass interim measures.
Originally, Republicans wanted to ban federal funds for Planned Parenthood, a health care services provider that is also the nation’s largest provider of abortions.
Federal funds may not be used to pay for abortions except in strictly regulated cases, but supporters of the ban said cutting off government funds for the organization — about $330 million a year — would make it harder for it to use its own money for the same purpose.
Democrats rejected the proposal in private talks. Officials in both parties said Republicans returned earlier in the week with a proposal to distribute federal funds for family planning and related health services to the states, rather than directly to Planned Parenthood and other organizations.
Democrats said they rejected that proposal, as well, and then refused to agree to allow a separate Senate vote on the issue as part of debate over any compromise bill.
Instead, they launched a sustained campaign at both ends of the Capitol to criticize Republicans.
“We’ll not allow them to use women as pawns,” said Sen. Patty Murray, a fourth-term lawmaker from Washington who doubles as head of the Democratic senatorial campaign committee.
For Congress and Obama there are even tougher struggles still ahead — over a Republican budget that would remake entire federal programs, and a vote to raise the nation’s debt limit.
Associated Press writers Andrew Taylor, Alan Fram, Julie Pace and Ben Feller contributed to this story.


