Two US officers shot and killed two armed civilians who tried to kidnap them last month in Yemen's capital, a State Department official said Friday.

The two Americans were removed from Yemen shortly after the shooting, the official added.

"We can confirm that, last month, two US Embassy officers in Yemen fired their weapons after being confronted by armed individuals in an attempted kidnapping at a small commercial business in Sanaa," deputy State Department spokeswoman Marie Harf said in a statement to AFP.

"Two of the armed individuals were killed. The embassy officers are no longer in Yemen."

The incident occurred amid fresh tensions in the already troubled nation after the army launched a major offensive against Al-Qaeda in the Arabian Peninsula on April 29.

Suspected Al-Qaeda militants attacked Yemen's presidential palace earlier Friday, killing five guards and triggering a fierce gunfight as the extremists hit back at the offensive.

President Abdrabuh Mansur Hadi was not at the palace in the capital when gunmen attacked a checkpoint manned by guards outside the compound, a security source said.

The New York Times said a lieutenant colonel with the elite US Joint Special Operations Command and a Central Intelligence Agency officer were involved in the shooting on April 24.

Some US officials told the newspaper that the two officers were getting a haircut at a barbershop in an upscale district of the capital popular with foreigners rather than a clandestine operation, though it remains unclear exactly what they were doing.

The Yemeni defense ministry indicated at the time that a foreigner had shot dead two gunmen who had tried to abduct him, but did not indicate the nationality of any of the people involved.

Security sources had said the man was a Russian expert working in the oil sector, and that his attackers were Yemenis from the Marib region east of Sanaa.

The case has parallels with the 2011 shooting of two men in Lahore, Pakistan by CIA contractor Raymond Davis. The incident sparked a diplomatic row between Pakistan and the United States.

Davis was jailed for weeks and released after paying blood money.

"There will certainly be an investigation and one would have to assume it will be informed by what happened in Pakistan," a US official told the Times, hinting Washington was keen on avoiding a repeat of the tensions over the Lahore case with close counterterrorism ally Yemen. (*****)