ISLAMABAD, Pakistan — Three gunmen who attacked the vehicle carrying the chief American diplomat in the northern city of Peshawar on Tuesday morning were armed with assault rifles and wore long hair and beards like the Taliban, the provincial police chief said.

The bulletproof Land Cruiser carrying the diplomat, Lynne Tracy, the principal officer at the U.S. consulate, was stopped by the three men who got out of an SUV and fired, according to the police official, Naveed Khan, inspector general of police in the North West Frontier Province.

Tracy, who was on her way to work at the consulate from her home about a mile away, was unharmed, he said.

The attack came as the Taliban, in virtual control of the tribal areas adjacent to Peshawar, press in on the city, conducting suicide bomb attacks and kidnappings of civilians.

The attack occurred in a district of the city known as University Town, considered one of the more secure areas with large houses protected by high walls and security guards.

About 30 Americans work at the consulate, mostly managing economic development programs and working in liaison between the American military and the Pakistani army. Since the Sept. 11, 2001, attacks on Washington and New York, when Pakistan joined the Bush administration in the campaign against terrorism, American diplomats in Pakistan have been restricted in their movements, and are advised not to travel outside the major cities.

In a statement, a spokesman for the American Embassy in Islamabad, Lou Fintor, said: "There was a security incident in Peshawar this morning involving a U.S. consulate vehicle." The statement said three employees were in the car.

A current focus of the consulate is a $750 million program intended to encourage economic development and to counter the influence of the Taliban in the nearby tribal areas. A number of Americans who work on that aid program but who are not officially employees of the consulate are now living in the city.

Two Americans were killed in 2002, when gunmen attacked a Protestant church inside the diplomatic enclave, a relatively secure area, in Islamabad. In 2006, a car rammed with explosives killed an American diplomat at the consulate in Karachi, Pakistan's largest city.

In the last year, suicide bombers have attacked Pakistani military targets in Peshawar. Last week, the Pakistani Taliban took responsibility for a suicide bomber who hit a bus carrying Pakistani air force personnel, killing 18 people, as it was traveling on a major city road.

On the political front in Pakistan, the political forces were garnering support for the presidential election, an electoral college poll of the National Assembly and four provincial assemblies, that will take place on Sept. 6.

The candidate for the major party, Asif Ali Zardari, the widower of former Prime Minister Benazir Bhutto, is favored to win and to become the next president following the resignation under pressure of President Pervez Musharraf.

Zardari who served more than eight years in prison in Pakistan on corruption charges that were dismissed this year under an amnesty agreement, filed medical records in the High Court in London that stated he suffered from a range of mental illnesses, according to an account in the Tuesday editions of the Financial Times.

According to the newspaper, the medical records said he suffered from dementia, major depression disorder and post-traumatic stress disorder and was unable to appear in court to challenge corruption charges by the Pakistani government alleging that he had bought a British country manor with ill-gotten gains.

The Pakistani High Commissioner in London, Wajid Shamsul Hasan, an appointee of Zardari, said Zardari was now healthy, the report said.