Updated

Rep. Steny Hoyer emerged victorious Thursday after a bruising battle to win the No. 2 House leadership post in the 110th Congress.

Hoyer handily defeated Rep. John Murtha, who had the backing of House Speaker-nominee Nancy Pelosi to be her chief deputy when Democrats take back the House in January.

"My pledge to my caucus and my pledge to my country is: I will work as hard as I can, exercise as much talent as I have to make sure that the agenda that has been put before the American people by Nancy Pelosi and the Democratic Party, an agenda of change ... will take this country in a new direction," Hoyer said.

Hoyer's success is a setback for Pelosi, who had faced her first leadership challenge by tossing aside her current deputy, with whom she had a chilly relationship, in favor of her longtime ally. Pelosi had been nominated earlier in the day to be the Democratic nominee for House speaker, the first woman to become second in line in succession for the presidency.

In introducing the new leadership team, Pelosi congratulated Hoyer, but said before he speaks, she wanted to "acknowledge the magnificent contribution of Mr. Murtha to this debate on the war in Iraq."

"I thank him for his courage in stepping forward one year ago to speak truth to power. He changed the debate in this country in a way that I think gave us this majority in this November," Pelosi said of Murtha. "I was proud to support him for majority leader, because I thought that would be the best way to bring an end to the war in Iraq. I know that he will continue to take the lead on that issue for our caucus, for this Congress, for our country."

But Pelosi and Hoyer also made nice. Pelosi said she extends "great congratulations to Hoyer."

"I look forward to working with him in a unified way," Pelosi said. "We've had our debates; we've had our disagreements in that room. And now, that is over. As I said to my colleagues, as we say in church, let there be peace on Earth and let it begin with us. Let the healing begin. I am just delighted that we have a Democratic speaker and a Democratic majority."

For his part, Hoyer called Pelosi "a person of deep values, keen intellect and extraordinary political abilities."

"Nancy and I have worked together for four years, closely and effectively. And we have created the most unified caucus in the last half-century. Nancy and I, I think, have been a good team," he said.

Hoyer defeated Murtha 149-86. His success was aided by his record of campaigning in 82 districts this past election season, winning support ahead of time from both moderate and liberal members of the party and earning the backing of more than half of the 29 new Democratic House members.

Murtha had been pummeled in the news ahead of the Democratic caucus vote, but at his last "campaign breakfast" Thursday appeared pumped. Supporters wore campaign buttons into the party election room.

Unlike the other leadership races this week, the loser was asked to speak. Murtha said people asked why he didn't win, and the reason was "I didn't have enough votes."

But Murtha said he felt he had done a lot to change the direction of the debate on the Iraq war and would continue to do so from his position as chairman of the Defense Appropriations Subcommittee.

"I talk to the military leaders all the time. The military leaders know there's a limitation to military power. They know that it's time for us to redeploy," he said.

The contested vote for the majority leader occurred after each of the candidates was allotted 15 minutes to make their case or have supporters make speeches on their behalf.

Each of the candidates had been nominated by four colleagues. Murtha had been nominated by Pelosi, Reps. Loretta Sanchez of California, Kendrick Meek of Florida and Dennis Kucinich of Ohio, a 2004 presidential hopeful.

Nominations for Hoyer came from Reps. Henry Waxman of California, Elijah Cummings of Maryland, Dennis Cardoza of California, who also helped nominate Pelosi, and Representative-elect Brad Ellsworth of Indiana.

During the party vote, Rep. Rahm Emanuel, credited with engineering the Democratic takeover, became the caucus chairman. Rep. John Larson of Connecticut was re-elected vice-chairman while Rep. James Clyburn of South Carolina went unopposed to become majority whip, the No. 3 spot in the Democratic line-up.

Speaking to the caucus after winning the nomination by acclamation, Speaker-to-be Pelosi vowed to keep the party clean.

"We made history and now we will make progress for the American people," she said. "We will not be dazzled by money and special interests."

Pelosi also called for unity in the party, but within moments she put her prestige on the line by nominating Murtha for majority leader.

Pelosi had publicly backed Murtha, a longtime friend whose recorded session with undercover FBI agents, alleged record of earmarking pet projects while vice-chairman of the Defense Appropriations Subcommittee and comments on recent ethics reform proposals had raised questions among some about his fitness to lead and Pelosi's judgment in supporting him.

Pelosi's public endorsement was thought to have had the effect of stripping some support from Hoyer, who has had a cool relationship with Pelosi while the two have served in the Democratic leadership together.

Asked about her decision to support Murtha, Pelosi later told reporters that she did not think her endorsement had marred her ability to lead the caucus or its ongoing unity.

"I am completely jubilant today to be nominated by acclamation by my party. I have to be who I am and I am a person who is committed to ending this war. It has been a grotesque mistake. ... and I promise I will do everything possible to end it," she said. "The caucus thought differently."

Hoyer added that while he and Pelosi may have had differences sometimes, "our caucus is unified today. Now, I intend to do everything in my power ... to make Nancy Pelosi the most successful speaker" in U.S. history.

The chilly cooperation between Hoyer and Pelosi dates back to when the two ran against each other for the minority whip post in 2001. Murtha steered the winning campaign for Pelosi. In return, she showed her allegiance, and with allies like California Rep. George Miller reportedly working behind the scenes for Murtha, especially during one-on-one meetings with Democratic freshman who must rely on Pelosi for committee assignments.

Just before the vote, a Democratic source responded to allegations that Murtha did not have the votes to win or that he would bow out. The source said those rumors are "absolutely false, a surreptitious attempt by Hoyer's team to weaken the support for Murtha."

While the pledges of party unity are made for public consumption, a Hoyer victory could be seen as a defeat for Pelosi in her first major move since Election Day. The race roiled a Democratic caucus that needs maximum cooperation in order to rule the fractious House effectively come January.

Many Democrats also expressed dismay that the family feud had broken out in the first place and objected to heavy pressure placed on longstanding Hoyer supporters.

Murtha is not going into the night by any means. He is expected to remain on the Defense Appropriations Subcommittee, which he will chair. That gives him a lot of authority to determine the Pentagon's budget and force the decision-making hands at the Department of Defense.

Hoyer, 67, a 25-year veteran in Congress, also had public backing from nine veteran lawmakers who are in line to become committee chairmen. Pelosi is in charge of designating committee assignments.

While Democrats voted on their leadership, House Republicans, finding themselves in the minority for the first time since 1994, demonstrated that they too are seeking unity ahead of their leadership elections on Friday.

Speaker Dennis Hastert of Illinois is leaving the leadership ranks. The race to become the House's top Republican came down to two on Wednesday — current Majority Leader John Boehner of Ohio and Rep. Mike Pence of Indiana. Energy and Commerce Committee Chairman Joe Barton of Texas dropped out late Wednesday and endorsed Boehner.

"This race was and is a contest among allies and it will remain so. If we're going to get our majority back in two years, we're all going to need each other," Boehner said acknowledging Barton's support.

The Republicans met behind closed doors on Thursday to make their cases. The second-in-command job for the GOP is also being contested. Majority Whip Roy Blunt of Missouri faces Rep. John Shadegg of Arizona.

FOX News' Molly Hooper and The Associated Press contributed to this report.