Taking up the new post means that Petreus will relinquish command of all US forces in the Middle East to focus solely on Afghanistan.

The US is pinning its hopes on the four-star general to turn around a deteriorating security situation in Afghanistan, where the Taliban and other opposition groups are launching increasingly effective operations against international forces in the country.

Earlier on Wednesday, the Taliban launched an attack on a Nato military basein Jalalabad to "send a message to David Petraeus."

In June, more than 100 soldiers were killed, making it the bloodiest month for the Nato force since the US-led invasion in the autumn of 2001, and the American public is becoming increasingly war-weary.   

At his confirmation hearing on Tuesday, Petraeus warned that there would be no quick fixes in Afghanistan, speaking of the need for "tough fighting" against the Taliban. 

"Indeed, it may get more intense in the next few months," he told the Senate Armed Services Committee before his appointment was approved.  

Petraeus is no stranger to commanding difficult and unpopular military operations. 

He was widely credited implementing a new approach in the Iraq war that brought the country back from the brink of civil war when he took control in January 2007.