Islamabad: Taliban gunmen fired shots at Pakistani Prime Minister Yousuf Raza Gilani's motorcade near Islamabad airport on Wednesday, but officials and police said he was not in it at the time.

The Taliban claimed responsibility for the attack days ahead of a presidential election, which is bound to compound the fears of investors and allies, who worry about chronic political instability and violence in the country.

Senior police official Rao Mohammad Iqbal said the motorcade was heading to the airport to pick up Gilani when it was attacked.

"The car was going towards the airport when it was fired upon from a small hill ... two bullets hit the driver's window," Iqbal said. Earlier, Gilani's spokesman, Zahid Bashir said shots were fired at Gilani's motorcade but he was not hurt.

The prime minister's office said multiple sniper shots had been fired and television pictures showed two bullet marks a couple of inches apart on the cracked bullet-proof window. A Taliban spokesman said Gilani was attacked because he was responsible for offensives against militants in the northwest.