Defense Secretary Chuck Hagel announced Monday he is stepping down, leaving under pressure following a rocky tenure in which he has struggled to break through the White House's insular team of national security advisers.

During a White House ceremony, Obama said he and Hagel had determined it was an "appropriate time for him to complete his service."

Hagel is the first senior Obama adviser to leave the administration following the sweeping losses for the president's party in the midterm elections. It also comes as the president's national security team has been battered by crises including the rise of Islamic State militants in Iraq and Syria and Russia's provocations in Ukraine.

The president praised Hagel, a Republican who grew close to Obama while they both served in the Senate, as an "exemplary defense secretary" who forged a strong bond with troops stationed around the world. Hagel, who served in the Vietnam War, is the first enlisted combat veteran to serve as defense secretary.

"Chuck Hagel has devoted himself to our national security and our men and women in uniform across six decades," Obama said.

While Obama has sought to consolidate foreign policy decision-making within the White House, advisers have privately worried about Hagel's ability to communicate the administration's positions. There have also been concerns that Hagel wasn't proactive or engaged in Cabinet meetings and other national security discussions.

In what appeared to be an effort to refute that criticism, Obama said Monday that Hagel had always "given it to me straight" during their private conversations in the Oval Office.

Hagel has had his own frustrations with the White House. In recent weeks, he sent a letter to national security adviser Susan Rice in which he said Obama needed to articulate a clearer view of the administration's approach to dealing with Syrian President Bashar Assad. The letter is said to have angered White House officials.

Hagel submitted his resignation letter to Obama on Monday morning. The 68-year-old said he had agreed to remain in office until a successor is confirmed by the Senate.

Hagel's aides assert that he is leaving at an appropriate juncture, after having brought to fruition this year several major initiatives on nuclear weapons management and as well as reforms to the military justice system and to the military health system. But his departure also coincides with a period of great uncertainty over the course of the administration's campaign to defeat the Islamic State group, as well as worry over Russia's actions in Ukraine.

Among the leading contenders to replace Hagel is Michele Flournoy, who served as the Pentagon's policy chief for the first three years of Obama's first term. Flournoy, who would be the first woman to head the Pentagon, is now chief executive officer of the Center for a New American Security, a think tank that she co-founded.

The timing of Hagel's departure sets up a potential confirmation fight in the Senate. Republicans, who will take control of the body next month, have been deeply critical of the president's foreign policy.

Hagel served as senator from Nebraska and became a critic of U.S. involvement in Iraq. After Obama nominated him to succeed Leon Panetta as defense secretary in his second term, Hagel struggled through a confirmation hearing that raised early concerns about him within the White House.

Recent questions about Hagel's future at the Pentagon were prompted in part by his decision to postpone a long-planned trip this month to Vietnam. At the time, officials said he needed to remain in Washington for congressional consultations, but that did not stop speculation that the White House might be looking for a replacement for the final two years of Obama's term.

Just last week Hagel was asked about the speculation during an interview on the Charlie Rose show. He was asked whether he's concerned by the speculation.

"No. First of all, I serve at the pleasure of the president," Hagel said. "I'm immensely grateful for the opportunity I've had the last two years to work every day for the country and for the men and women who serve this country. I don't get up in the morning and worry about my job. It's not unusual by the way, to change teams at different times."

Hagel was the first enlisted combat military veteran to become secretary of defense. He served in the Vietnam War and received two Purple Hearts.

Hagel forged a strong personal relationship with Obama in the Senate and they made several overseas trips together, including the high-profile visit Obama made in the final months before the 2008 presidential campaign. He carved out a reputation as an independent thinker and blunt speaker, and Obama said he came to admire his courage and willingness to speak his mind.

He was an Army infantry sergeant who risked his life to pull his younger brother to safety while both were serving in Vietnam.

Wounded himself in Vietnam, Hagel initially backed the invasion of Iraq, but later became a critic of the wars, making routine trips to Iraq and Afghanistan. He opposed President George W. Bush's plan to send an additional 30,000 troops into Iraq - a move that has been credited with stabilizing the chaotic country - as "the most dangerous foreign policy blunder in this country since Vietnam, if it's carried out."

While Hagel supported the Afghanistan war resolution, over time he has become more critical of the decade-plus conflict, with its complex nation-building effort.