(Updates with attempted bombing at Islamabad mosque)
By Gul Yusufzai
QUETTA, Pakistan, Aug 9 (Reuters) - Violence marred the Muslim holy day of Eid al-Fitr in Pakistan on Friday with gunmen killing nine people in the city of Quetta while a guard in the capital Islamabad shot dead a would-be suicide bomber forcing his way into a mosque.
The United States has ordered non-essential staff to leave its consulate in the eastern city of Lahore because of the threat of attack. It has also warned its citizens not to travel to Pakistan.
In Quetta, gunmen fired on the vehicle of a politician driving past worshippers leaving a mosque, killing nine people and wounding 27, police said.
Quetta is capital of the southwestern province of Baluchistan, where several militant groups are active, including the Pakistani Taliban, who claimed responsibility for a suicide bomb attack that killed 30 people at a policeman's funeral on Thursday.
Police official Bashir Brohi said Friday's shooting seemed to have been aimed at former provincial government minister Ali Mohammad Jattack, who was passing by in a vehicle, but the motive and perpetrators were not clear.
"I was the target," Jattack told media at the scene.
"They killed innocent worshippers belonging to different communities. This is against humanity, it is brutality on the level of animals," said Jattack, who was not hurt.
Brohi said most of the victims were coming out of the mosque.
"It was an armed attack on the former minister ... it was not an attack on the mosque," the police official said.
In a separate attack in Islamabad, a would-be suicide bomber shot dead a guard and wounded three people as he tried to force his way into a Shi'ite mosque, said witness Raza Mohammad.
"Hearing the shots, the second guard went rushing in and shot the bomber in the head," Mohammad told Reuters.
NEW PRIME MINISTER
Interior Ministry spokesman Omar Hamid Khan said the bomb disposal unit was on the scene trying to defuse explosives packed into a vest the man had been wearing.
Attacks against Pakistan's minority Shi'ite Muslims, by Sunni Muslim militants, are increasing sharply.
The attacks on Friday were the latest in a surge of militant violence since Prime Minister Nawaz Sharif took office two months ago, with a string of high-profile incidents in the past two weeks.
Sharif's government has not presented a security strategy, despite campaign promises to negotiate with militant groups.
Security in Islamabad was tightened in the run-up to the Eid holiday, which fell on Friday in Pakistan and marks the end of the fasting month of Ramadan.
The United States shut nearly two dozen missions across the Middle East after a worldwide alert on Aug. 2, warning Americans that al Qaeda may be planning attacks in August, particularly in the Middle East and North Africa.
It was not clear when the U.S. consulate in Lahore, Pakistan's second biggest city, would open, a U.S. embassy spokeswoman said.
Tension has also risen between Pakistan and its neighbour, India, this week after five Indian soldiers were killed near the border running through the disputed Kashmir region. (Writing by Katharine Houreld; Editing by Clarence Fernandez and Robert Birsel)