April 8, 2011 -- Barely more than an hour before a midnight deadline, officials announced a deal to avert a government shutdown.

"We will cut $78.5 billion below the president's 2011 budget proposal, and we have reached an agreement on the policy riders," House Speaker John Boehner, R-Ohio, and Senate Majority Leader Harry Reid, D-Nev., said in a joint statement.

The agreement would cut about $38 billion from the 2010 baseline budget, and the deal on the riders kept intact funding to Planned Parenthood, sources said.

"We protected the investments we need to win the future," President Obama said after the deal was struck. "At the same time, we also made sure at the end of the day this was a debate about spending cuts -- not social issues like women's health and the protection of our air and water. These are important issues that deserve discussion, just not during a debate about our budget."

The Senate passed a temporary resolution to keep the government funded beyond midnight, when it was scheduled to run out, until the full agreement can be drawn up and passed by Congress. That short-term bridge included the first $2 billion in cuts, officials said.

The House was expected to pass the same bridge measure, Boehner said.

"I would expect the final vote on this to occur mid-next week," Boehner said. "This has been a long discussion and a long fight, but we fought to keep government spending down because it really will, in fact, help create a better environment for job creators in our country."

The House hadn't voted by midnight, but the Office of Management and Budget said there would be no shutting down of government agencies because agreement had been reached and funding was anticipated.

Senate Republicans pointed out that as recently as February, Democratic leaders denounced even more modest cuts than those in the deal as "draconian," "extreme" and "unworkable." They had to go the brink of a shutdown, the Republicans said but Boehner's hard line, in the end, forced Democrats to agree to several billion more in cuts.

However, Democratic officials tried to portray the deadline deal as one in which Boehner blinked. They argued the level of cuts were similar to what were discussed during a meeting at the White House the night before. The officials said Boehner came back during Friday asking for more cuts, but Obama refused.

Plus, money will not be taken from programs the president favors, such as Head Start, but instead from the automatic "mandatory spending" appropriated for departments such as the Pentagon and the Department of Transportation.

"They gave on the EPA, NPR, and Planned Parenthood riders," a Democratic official said.

However, the deal does include an abortion funding ban for Washington, D.C., which President Obama has signed into law before. And, Democrats added, the agreement calls for the Senate to hold votes on rescinding the health care law and eliminating funding for Planned Parenthood.

Just hours before government funding was set to expire at midnight, Republican congressional leaders gathered on Capitol Hill for face-to-face meetings this evening. Initially, they denied a deal was on the table.

"We would like to clear up some confusion and relay that there is not yet a deal reached," House Majority Whip Kevin McCarthy, R-Calif., wrote in a message to the House GOP conference, "but negotiations are ongoing."

However, a high-level House GOP source emailed ABC News: "Looks like there'll be a deal, but there are several important details yet to be worked out." The source added that leadership in the Republican House was confident the details could be resolved before midnight.

Boehner later laid out the specifics of "a deal in principal" to the entire House GOP conference in a closed meeting, a source at the meeting said. The source said reaction to the deal was "pretty favorable."

As Republicans met, Reid repeatedly postponed plans to address the potential government shutdown on the Senate floor.

Before the GOP meetings, Capitol Hill sources seemed to be all over the map when asked if a deal on a proposed Republican rider to defund some Planned Parenthood women's health programs was in the works, or whether there would be an overall spending deal.

Some sources close to the negotiations said the Planned Parenthood issue might be tabled for another day in order to focus the negotiations on other matters of government spending, while others suggested the issue still was a sticking point.

Earlier, senior Republicans denied Planned Parenthood was the key sticking point holding up a deal.

"There's only one reason that we do not have an agreement as yet, and that issue is spending," Boehner said today. "We're close to a resolution on the policy issues, but I think the American people deserve to know: When will the White House, and when will Senate Democrats get serious about cutting spending?"

However, Reid said the two sides had agreed to $38 billion in cuts and many of the Republicans' so-called "policy riders" -- but not the one that aimed to bar funding for Planned Parenthood.

He assailed Republicans, saying talks have deadlocked on "ideology."

"Republicans want to shut down the government because they think there's nothing more important than keeping women from getting cancer screenings," Reid said. "This is indefensible and everyone should be outraged. Men and women should be outraged. Republican House leadership have only a few hours left to look in the mirror and snap out of it and realize how positively shameful it would be."

Republicans continued to dispute Reid's suggestion that there was agreement on the budget cuts.

"If the government shuts down, it's either because Democrats are pretending -- pretending that a previously non-controversial provision is suddenly out of bounds -- or they refuse to take another baby step in the direction of balancing the government checkbook, something we know the American people want," said Senate's top Republican Mitch McConnell, R-Ky.

A government shutdown would have had wide effects, including perhaps 800,000 federal worker furloughs, curtailment of public services such as mortgage, passport and loan processing, delayed tax refunds, interruption of military paychecks and disruption to a recovering economy.

Essential personnel kept on duty during a government shutdown -- including troops in the field -- would not receive paychecks, but members of Congress would.

Boehner said today he would return his pay during the days the government was shut down.

"In the event of a lapse in appropriations for fiscal year 2011 causing a government shutdown, I will return any and all compensation that I would otherwise be entitled during such a lapse in appropriations," Boehner said in a letter to fellow House members.

Also on Friday, 60 members of the Democratic-controlled Senate signed on to a bill that would ensure troops were paid through a shutdown.

The move followed House Republicans' Thursday passage of a temporary resolution to fund the Pentagon and keep the government running for another week. That legislation, however, was dismissed by Democrats as political cover and ideological.

Reid and Boehner met with President Obama at the White House Thursday night for their fourth meeting this week.

Sources said the two sides agreed that their teams would find a number between $35 billion and $39 billion. The size of the cut would depend upon the composition of what was being cut. But Boehner would not commit to ending the demand that Planned Parenthood be defunded.

Boehner had Tea Party-aligned freshman who felt that if they couldn't meet the pledge they made of $100 billion in cuts to Obama's budget, they wanted to be able to present something to their constituents that they got in return -- ending government funding of abortion in Washington, D.C., for instance, or cutting off funding to Planned Parenthood.

"We've got to have something to go home with," Rep. Blake Farenthold, R-Texas, told ABC News. "If we don't get the full $100 billion, we need some of the policy riders. That way I can go back, look the folks at home in the eye and say 'Look, I couldn't get $100 billion but I got you X, Y, and Z."

Abortion took center stage in the fight over spending cuts. The abortion measure in the House Republicans' extension bill, and one they say they won't budge on, would reinstate a policy that prevented the District of Columbia from using locally generated taxes to provide financial help to poor women for abortions.

The House voted earlier this year to defund Planned Parenthood, but 41 Democrats in the Senate said they would not support that legislation. The White House said the president would not agree to any ban on funds to Planned Parenthood.

"We've come to realize that the moving target has now focused a bull's eye on women in America," Reid said. "We agreed on a number. But we are not -- we are not -- bending on women's health."

Planned Parenthood already is prohibited from using any federal funds for abortion-related services. Officials of the organization say more than 90 percent of what Planned Parenthood clinics do has nothing to do with abortion, but rather focuses on women's health services such as pap smears and mammograms.

Abortion opponents say federal funding for other services means money freed up for the purposes of conducting abortions, which they regard as ending human life.

The president cancelled his scheduled trip to Indiana today to remain in Washington, D.C., to take part in the negotiations.

It was unclear whether the Obamas would take their long-planned trip to colonial Williamsburg this weekend. All national parks would have closed in the event of a government shutdown.

The last time the government shutdown fully was in 1995, under President Clinton, for five days. A 21-day partial shutdown followed soon after.

Under federal laws, essential staff still would have had to report to work, but all nonessential staff would have been furloughed without pay. Each agency was responsible for identifying its essential staff. Federal employees who are "necessary to protect life and property" and are needed to perform an "orderly shutdown of emergency operations" were considered "essential." That includes most national intelligence staff, military personnel, air traffic controllers, law enforcement, emergency and disaster personnel, the Transportation Security Administration, Coast Guard and similar staff.

Furloughed staff would not have been allowed to work as unpaid volunteers to the government, enter their offices, use their work BlackBerries or computers, and access their work email.

ABC News' John Parkinson and Matthew Jaffe contributed to this report.