Taliban founder Mullah Omar lived within walking distance of US bases in Afghanistan for years, according to a new book that highlights embarrassing failures of American intelligence.

Washington believed the one-eyed, fugitive leader had fled to Pakistan, but the new biography says Omar was, in fact, living just three miles from a major US Forward Operating Base in his home province of Zabul before his death in 2013.

"Searching for an Enemy", by Dutch journalist Bette Dam, reveals the Taliban chief lived as a virtual hermit, refusing visits from his family and filling notebooks with jottings in an imaginary language.

Dam spent more than five years researching the book and interviewed Jabbar Omari, Omar's bodyguard who hid and protected him after the Taliban regime was overthrown.

According to the book, Omar listened to the BBC's Pashto-language news broadcasts in the evenings, but even when he learned about the death of al-Qaeda supremo Osama Bin Laden rarely commented on developments in the outside world.

Following the 9/11 attacks in 2001 which led to the fall of the Taliban, the US put a $10 million bounty on Omar and he went into hiding in a small compound in the regional capital Qalat, Dam writes.

The family living at the compound were not told of the identity of their mystery guest, but US forces twice almost found him.

At one point, a US patrol approached as Omar and Omari were in the courtyard. Alarmed, the two men ducked behind a woodpile, but the soldiers passed without entering.

A second time, US troops even searched the house but did not uncover the concealed entrance to his secret room. It was not clear if the search was the result of a routine patrol or a tip-off.

Omar decided to move when the US started building Forward Operating Base Lagman in 2004, just a few hundred metres from his hideout.

He later moved to a second building but soon afterwards the Pentagon constructed Forward Operating Base Wolverine -- home to 1,000 US troops, and where American and British special forces were sometimes based -- close by.

Despite his terror at being caught, he dared not move again, rarely even going outside and often hiding in tunnels when US planes flew over.

According to Dam, Omar would often only talk to his guard and cook, and used an old Nokia mobile phone, without a sim card, to record himself chanting verses from the Koran.

Omar's Taliban ruled Afghanistan from 1996 until 2001 and has waged an anti-government insurgency since then.

Omar, who delegated effective Taliban leadership after 2001, appears to have acted as more of a spiritual leader, and the militant movement kept his death in 2013 secret for two years.