An apparent attempt to assassinate Afghan President Hamid Karzai (search) failed Thurdsday when a rocket that was fired at his helicopter missed by 300 yards, the U.S. military said.

The American military helicopter was preparing to land in Gardez, 60 miles south of Kabul (search), when the rocket was fired. The aircraft immediately turned around and returned to Kabul, U.S. military spokesman Maj. Mark McCann said.

"The president was not in any imminent danger," McCann said.

It was at least the second apparent attempt on the U.S.-backed interim leader's life since he took office in 2001, and the most ominous incident yet in the run-up to next month's landmark election.

Karzai's spokesman, Jawed Ludin, said the rocket came down much further away -- in a village more than a mile from Gardez -- and suggested Karzai didn't want to abandon his trip to the city, where he was to attend a school opening.

"He's disappointed and a little upset that the security sometimes in these situations over-reacts," Ludin said. "He wished to have landed and spoken to the people."

No one was hurt on the ground or in the air.

It was not clear who fired the rocket, but suspicion will fall on militants including the former ruling Taliban waging a stubborn insurgency against Karzai's U.S.-backed administration.

Officials are bracing for a surge in violence in the run-up to next month's landmark presidential election, which Afghanistan (search)'s international sponsors hope will cement the shaky peace process begun after the United States drove out the Taliban in 2001 for harboring Osama bin Laden.

The school opening was not officially part of Karzai's election campaign. But the attack is still a setback as he tries to muster a majority in the Oct. 9 ballot and avoid a second-round runoff.

Gardez is just 60 miles south of Kabul, but security concerns still meant Karzai needed the U.S. military as his escort.

Karzai has said he is too busy leading the country to do a lot of the campaigning, and that his two deputies will tour the provinces in a bid to see off the electoral challenge from the 17 other candidates.

A dozen election workers have already been killed during a drive to register millions of Afghans for the country's first-ever direct presidential election.

In all, more than 900 people have died so far this year in political violence across the country.

The president has been shadowed by bodyguards from an American security firm since shortly after the unsolved killing of Vice President Abdul Qadir on July 6, 2002.

Karzai's guards shot and killed an attacker who opened fire at Karzai in Kandahar on Sept. 5 the same year. Karzai hails from Kandahar, the former stronghold of the ousted Taliban regime.