Democratic and Republican leaders traded blame on Friday in a budget impasse that threatened to shut down the government within hours and idle hundreds of thousands of federal workers.

With a midnight deadline looming, President Barack Obama's aides and lawmakers struggled for a deal over government funding for the rest of the fiscal year, which ends September 30. But the two sides could not even agree on what issues were holding up an agreement.

Democrats said they were at odds over federal funding for birth control. Republicans said spending cuts were the issue.

Without an agreement, money to operate the federal government for the next six months would run out at midnight on Friday and agencies such as the Internal Revenue Service would begin a partial shutdown.

There was word from the Republican camp that some progress was made in last-minute talks. But a phone call between Obama and House of Representatives Speaker John Boehner, the top Republican in Congress, yielded no resolution, a Republican aide said.

It was unclear whether a deal, even for a few extra days of stopgap funding, could be struck in time. Obama scrapped a family weekend trip to Williamsburg, Virginia, to stay home and monitor events.

The bitter political fight raised questions about the ability of Obama and a divided Congress to deal with bigger issues looming down the road, from raising the federal debt ceiling to reining in budget deficits, as the 2012 presidential election campaign gathers steam.

They've got to be laughing at us right now in China, said Senate Foreign Relations Committee Chairman John Kerry. How terrific that the United States of America can't make a decision.

The leadership of the world's lone remaining superpower has been consumed for days by the budgetary infighting that could bring large swathes of government to a standstill.

The White House said a shutdown would idle about 800,000 federal government workers and could slow the U.S. economic recovery. Vital services such as defense, law enforcement, emergency medical care and air traffic control would continue.

Without a deal, many official websites would darken and furloughed government workers would be required to turn off Blackberries. Trash would go uncollected in Washington, and national parks and monuments like the Statue of Liberty in New York would close.

Investment firm Goldman Sachs estimates a government shutdown lasting more than a week could cost the economy $8 billion in missed federal spending, dragging down growth.

AT ODDS

Republican and Democratic aides said negotiators have agreed to $38 billion in cuts but remain at odds over where they would fall. Republicans are resisting a Democratic proposal to cut $1.7 billion from defense.

Reid said the final issue was a Republican push to give states greater discretion over federal funds earmarked for birth control and women's health clinics. Democrats say that would give Republican governors license to block those funds.

Republicans want to shut down the government because they think there's nothing more important than keeping women from getting cancer screenings. This is indefensible and everyone should be outraged, Reid said on the Senate floor.

But Boehner said the final stumbling block was spending cuts that Republicans say are needed to rein in budget deficits hitting $1.4 trillion a year.

We're not going to roll over and sell out the American people like has been done time and time again in Washington. When we say we're serious about cutting spending, we're damn serious about it.

Senate Republican Leader Mitch McConnell said he expected lawmakers to reach agreement on a spending plan and avert a government shutdown.

Fear that a government shutdown could hurt economic growth on the margins pressured the dollar and Treasury prices on Friday. Longer-term, investors are looking at the last shutdown, in 1995, when predictions of spending cuts made government debt and the dollar more appealing and both rose.

Citigroup noted the budget debate is raising concern among foreign investors about how the government will deal with the budget deficit, federal debt and the budget talks for the 2012 fiscal year, which begins October 1.

The showdown is the biggest test of leadership for Obama, a Democrat, and congressional leaders since Republicans -- propelled by Tea Party conservatives -- made big gains and took control of the House in elections last November.

The confrontation carries big risks for both parties, who could be seen by voters as failing to make compromises. But Boehner is under pressure to stand firm in the talks from Tea Party members who refuse to give ground on spending cuts.

(Additional reporting by Patricia Zengerle, Kim Dixon, Donna Smith, David Alexander, Thomas Ferraro and David Morgan; Writing by John Whitesides and Matt Spetalnick; editing by Will Dunham and Deborah Charles)