Al Qaeda militants are the main suspects in an attack on a police checkpoint outside the U.S. consulate in Istanbul, an official has confirmed.

Gunman clashed with police Wednesday, killing three officers. Three of the four attackers were also killed.

A police official in Istanbul, speaking on the condition of anonymity, told The Associated Press that authorities suspected al Qaeda was behind the attack.

Turkish and U.S. officials are labelling the incident as an act of terrorism but no group has formally been named as responsible.

"It is, of course, inappropriate now to speculate on who may have done this or why. It is an obvious act of terrorism," U.S. Ambassador Ross Wilson said Wednesday. "Our countries will stand together and confront this, as we have in the past."

Istanbul Gov. Muammer Guler did say that at least two of the attackers were Turkish nationals.

"There is no doubt that this is a terrorist attack," said Guler, who described the three slain policemen as "martyred."

Checkpoint attacked

The shootout took place near the consulate's main entrance in Istanbul's Istinye district but the attackers did not penetrate the compound.

No U.S. embassy officials were injured in the attack.

Security camera footage outside the consulate showed four armed and bearded men get out of a car and kill a traffic policeman.

"One of them approached a policeman while hiding his gun and shot him in the head,'' Yavuz Erkut Yuksel, a bystander, told CNN-Turk television.

The men then ran toward the guard post about 50 metres away as other policemen fired back, according to the Dogan news agency.

Television footage from the scene showed four people lying on the ground outside the consulate.

Abdullah Bozkurt, the executive editor of Today's Zaman, a Turkish daily newspaper, said Wednesday that the three dead officers were all Turkish nationals.

"One is a security guard, another two (were) traffic police officers," Bozkurt told CTV.ca.

During the incident, U.S. security personnel stayed inside the compound as they're not authorized to fight on Turkish soil, Dogan reported.

Guler said another policeman and a tow-truck driver were also injured in the attack.

Meanwhile, only one of the attackers managed to escape alive, fleeing the scene in a car, said police.

In 2003, militants linked to al Qaeda carried out suicide bombings on two synagogues, the British consulate and a British bank in Istanbul -- killing 58 people.

The U.S. consulate building was built following those attacks.

With files from The Associated Press