Eric Fanning, one of Defense Secretary Ashton Carter's closest advisers, has been tapped to serve as acting undersecretary of the Army, the Defense Department announced.

Fanning, who is Carter's chief of staff, will fill a role in the Army's leadership ranks that has been open since Brad Carson became the acting undersecretary of defense for personnel and readiness. Fanning's appointment also comes as Army Secretary John McHugh prepares to leave his post this fall.

"Eric will provide Secretary McHugh with vital support as he prepares to conclude his tenure," Carter said in a statement. "I will forever be grateful for Eric's advice and leadership during this crucial first phase of my time as secretary of defense, and look forward to continuing to work with him as he helps lead the men and women of the world's most powerful ground force."

Fanning is "a welcomed and greatly valued addition" to the Army's senior leadership team, McHugh said in a statement.

"I've worked with him during my tenure as secretary, and I have been consistently impressed with his skills, professionalism and positive demeanor," McHugh said. "We are fortunate to have him on board in a position critical to the success of our soldiers, civilians and families."

McHugh announced in June that he plans to leave his post as the Army's top civilian leader by November. McHugh has been the Army secretary since September 2009.

Fanning almost immediately emerged as the most likely candidate to replace McHugh, and this latest personnel move by Carter puts him in prime position for the top job when the time comes.

Widely viewed as one of the most capable leaders in the Pentagon, Fanning became Air Force undersecretary in April 2013. He served several months as acting secretary while the confirmation of now-Secretary Deborah Lee James was stuck in Congress.

Before that, he was deputy undersecretary of the Navy and its deputy chief management officer from 2009-2013.

Fanning has spent the past several months as Carter's right-hand man, helping to organize his boss' transition to the Pentagon's top spot and managing day-to-day activities.

In addition to his long resume, Fanning would also mark a milestone, if he does become the Army secretary, as the first openly gay secretary of a military branch.

"One of my first decisions upon returning to the Pentagon was asking Eric Fanning to serve as my chief of staff," Carter said in his statement. "His deep well of knowledge and vast experience in the Pentagon, honed during his tenure as deputy undersecretary of the Navy and acting secretary of the Air Force, have been crucial assets for my front office."

As Fanning takes on his new job, Carter announced that his deputy chief of staff, Eric Rosenbach, will be promoted to chief of staff effective Monday.

Rosenbach, a former Army intelligence officer, Harvard faculty member and private executive, has served in a number of positions throughout DoD, culminating in his Senate confirmation as assistant secretary of defense for homeland defense and global security.