President Barack Obama on Tuesday named veteran diplomats to be the US ambassadors to Afghanistan and Pakistan, tasking them with shaping highly sensitive relationships after US troops pull out.

Two month after the incumbents resigned, Obama named Richard Olson, a former ambassador to the United Arab Emirates, to serve in Pakistan and James Cunningham, the number two at the US embassy in Kabul, to be the ambassador.

The two men will need confirmation by the Senate. They would serve as the United States prepares to withdraw combat forces from Afghanistan in 2014, a transition that also profoundly impacts rocky relations with Pakistan.

"I am grateful that these talented and dedicated men and women have agreed to take on these important roles and devote their talents to serving the American people," Obama said in a statement announcing several new postings.

"I look forward to working with them in the coming months and years," said Obama, who is seeking a second four-year term in November 6 elections.

The outgoing US ambassador to Pakistan, Cameron Munter, resigned in May after a turbulent tenure in which US forces secretly killed Osama bin Laden near Pakistan's main military academy, humiliating the powerful army.

Munter had been an advocate within the Obama administration for reconciliation with Pakistan. People close to him said he was frustrated that the CIA and Pentagon took the lead on Pakistan policy, with Munter's job effectively to contain the fallout.

After a half-year standoff, Secretary of State Hillary Clinton earlier this month said sorry to Pakistan for the deaths of 24 troops in an air raid near the Afghanistan border, leading Islamabad to reopen key supply routes.

Just two weeks after Munter's announcement, the US ambassador to Afghanistan, Ryan Crocker, also said he would leave his post early. The State Department said he decided to leave the stressful job for health reasons.

Olson, the nominee to be ambassador to Pakistan, is a 30-year veteran of the State Department who served as the envoy to the United Arab Emirates from 2008 to 2011.

Until last month, Olson served in the US embassy in Kabul as the coordinator for development and economic affairs, a key priority for Washington as the United States prepares to withdraw its forces.

Pakistan has repeatedly voiced fear that the United States will lose interest in the region with the end of the war, first launched after Al-Qaeda carried out the September 11, 2001 attacks on the United States.

US officials believe that Pakistan has maintained close ties with violent Islamic extremists in Afghanistan, most notably the Haqqani network, so as to preserve influence after the US withdrawal and balance arch-rival India.

The United States has insisted that it will maintain an interest in Afghanistan and earlier this month designated the war-torn country a major non-NATO ally, providing the framework for future cooperation.

Under an agreement signed by Obama and Afghan President Hamid Karzai, US troops will be able to stay in Afghanistan until at least 2024 to train Afghan troops and conduct operations against extremists.

Cunningham served as US ambassador to Israel before taking his post in Kabul. He has also served as consul general in Hong Kong and as deputy US representative at the United Nations.