Former defence secretary Robert Gates has said that US tried to eject Afghan President Hamid Karzai by manipulating presidential election in 2009, media reported Friday.

The revelations made by Gates in his memoirs -- Duty: Memoirs of a Secretary of War" -- is scheduled for release next week and covers the war in Afghanistan, The Guardian reported.

"It was all ugly: our partner, the president of Afghanistan, was tainted, and our hands were dirty as well," Gates is quoted as writing in his memoirs.

Karzai has long claimed that the US tried to manipulate the poll to remove him from office, while Washington insisted it was an impartial supporter of democracy.

The then top US diplomat Richard Holbrooke supported Karzai's rivals in the hope of pushing the poll to a second round that the incumbent would lose, Foreign Policy magazine reported.

Karzai has cited concerns about foreign interference in the poll to choose his successor later this year as one of the reasons for the delay in signing a long-term security pact with the US to keep troops in the country after 2014.

The deal is unlikely to be signed on the timetable the US government would like, the ambassador to Kabul warned in a secret cable leaked to the Washington Post.

US politicians and the military want it sealed early this year to allow for a smooth withdrawal and planning for next year if any troops stay on.

US-Afghan ties have been strained by a string of disagreements over civilian deaths, election planning and other issues, including the release of dozens of men Karzai says are innocent and the US claims are a serious security threat.

Washington insists that if there is no deal, it will resort to its "zero option" and take all troops home.

A White House spokesperson has, however, strongly denied Gates's claims.

Gates served as the Pentagon chief for nearly five years, which started from former president George W. Bush's second term and continued into Obama's first term at his request.