Two officers at the US embassy in Yemen shot and killed a pair of armed civilians who tried to kidnap them, the state department said on Friday.

The officers have left Yemen, Marie Harf, a spokeswoman for the state department, said in a statement. No other details were provided.

Citing unidentified US officials, the New York Times reported that the Americans were a CIA officer and a lieutenant colonel with the elite joint special operations command who were visiting a barber shop in an upmarket district in Yemen's capital.

Within days of the shooting, both Americans left Yemen with the approval of the Yemeni government, the newspaper reported. It said the shooting occurred on 24 April.

Earlier this week, the US embassy in Sanaa closed temporarily because of attacks on westerners. A day before Tuesday's closure, gunmen opened fire on three French security guards working with the European Union mission, killing one and wounding another.

The U.S. has waged a heavy campaign of drone strikes in Yemen against the group al-Qaida in the Arabian Peninsula. This month, the Yemeni government has been waging an offensive against the militant group, and violence around the country has been on an upswing.

On Friday, gunmen believed to be al-Qaida militants ambushed the motorcade of Yemen's defence minister in the Mahfad region, officials said. The assassination attempt failed.

Later in the day, a security checkpoint near the presidential palace in Sanaa came under attack, and at least two policemen died.

