WASHINGTON — Two months into full Republican control of Congress, GOP leaders are struggling to demonstrate they really are in charge.
The stunning House defeat Friday of a three-week spending bill for the Department of Homeland Security exposed Speaker John Boehner's weakness in the face of rebellious conservatives.
It also again demonstrated his need to rely on Democrats at critical moments as the minority party's agreement to a one-week spending bill helped the speaker get it over the finish line with only hours to spare before a threatened agency shutdown.
President Barack Obama signed the bill shortly before midnight.
Senate Majority Leader Mitch McConnell, R-Ky., already had bowed to Democrats' demands and stripped the contentious provisions rolling back Obama's immigration policies from his chamber's version of the Homeland Security spending bill.
The two leaders face different, and often competing, challenges as they try to produce the responsible governance they promised voters after November elections, when Republicans won control of the Senate and increased their House majority to the largest in 70 years.
Two months into the new Congress, the severe limits to their powers are confronting Boehner, R-Ohio, and McConnell as they aim to chart a course for the final two years of Obama's presidency. That path could help lead their party back into the White House, and perhaps even produce a few legislative achievements.
"Obviously we're not getting good results, are we? I base everything on results," said Rep. John Fleming of Louisiana, one of the many Republicans frustrated with the GOP's performance, particularly on the Homeland Security bill.
"Our leadership set the stage for this," Fleming said. "Yet we didn't really see much messaging, coordination or communication."
Even though Boehner has large numbers on his side, it's still not enough to ensure he can line up a majority on any given bill, especially on issues such as immigration, education or abortion. The GOP advantage is 245-188 with two vacancies.
A frustrated Rep. Devin Nunes, the California Republican who heads the House Intelligence Committee, lashed out at "a small group of phony conservative members who have no credible policy proposals and no political strategy to stop Obama's lawlessness" and seem to be "unaware that they can't advance conservatism by playing fantasy football with their voting cards."
McConnell is contending with Senate rules that give important rights to the minority party, which Democratic leader Harry Reid of Nevada is adept at exploiting.
Republicans hold 54 seats, but that is six short of the 60 needed to ensure passage of most legislation.
Democrats united against and ultimately blocked GOP attempts to use the Homeland Security spending bill as the measure to overturn Obama's immigration directives extending work permits to millions of people in the country illegally.
Many Republicans campaigned for re-election last fall on promises to stop Obama on immigration, and their inability to do so is infuriating to conservatives. That's why 52 of them in the House voted down a three-week agency spending bill Friday night in a humiliating defeat for Boehner and other Republican leaders.
"The problem is there are a whole lot of us, including leadership, who put out statements saying Obama's executive order was illegal, unconstitutional. How do you backtrack off of that?" asked Rep. Tom Rooney, R-Fla.
GOP leaders regrouped to offer a one-week bill, but it required the blessing of House Democratic leader Nancy Pelosi of California. She assured fellow Democrats the vote would pave the way for passage of a full-year bill next week, without the immigration language that has drawn a White House veto threat.
Boehner aides denied that any such assurances had been given.
The chaos was the most high-profile debacle for the GOP so far this year, but not the only one. Earlier in the day, House Republican leaders shelved an education overhaul bill amid conservative opposition. Previously they had retreated on border security legislation and an abortion bill.
In the Senate, McConnell has devoted much of the past two months to debates and votes related to the Homeland Security bill, as well as passage of the Keystone XL oil pipeline bill, which Obama has vetoed.
Along the way, there were lower-profile achievements.
The Senate approved Obama's defense secretary nominee, Ash Carter, on a resounding bipartisan vote. The House passed bills aimed at reining in Obama on taxes and regulation, although the measures are likely to hit a dead end in the Senate, just as they did when Republicans were in the minority.
But the GOP majority has been defined as much by infighting among Republicans and between the House and the Senate as by any achievements. That raises questions about Congress' ability to accomplish the many tasks before it, including passing a budget, increasing the nation's borrowing authority and passing a new use-of-force agreement to battle Islamic State militants.
"The DHS funding fight is the first test of the new Republican Congress, and so far they're failing," said Sen. Chuck Schumer, D-N.Y. "If the Republicans can't even fund something as simple as Homeland Security, we shudder to think what will happen when it's time to fund the whole government or raise the debt ceiling."
Associated Press writer Alan Fram contributed to this report.