Suspected al Qaeda-linked gunmen attacked Yemen's presidential palace on Friday and tried to kill the defence minister in his car, selecting high profile targets in apparent reprisal for the army's biggest push against militants in nearly two years.
Four soldiers were killed in a gun battle of up to an hour that broke out when militants attacked the main gate of the palace in the capital Sanaa, a security source said.
Sanaa was in lockdown after the gunfight, with checkpoints set up at all the main entrances into the capital.
There was no immediate reaction from any senior Yemeni officials on the attack. State news agency Saba published a brief statement saying three security personnel were killed when a "terrorist group" attacked their patrol vehicle.
An explosion was later heard near a building used by the government's intelligence services in another district of the city, residents told Reuters. There was no immediate word on the cause of the blast.
In the south, Defence Minister Muhammad Nasir Ahmad escaped an assassination bid by suspected al Qaeda gunmen who attacked a his motorcade in the province of Shabwa.
The defence ministry's website later said the shots heard near Ahmad's convoy were celebratory gunfire.
The violence capped a turbulent few days both for Yemen - a country Washington sees as one of the main battlefields in its global campaign against Islamist militants - and for its Western allies.
A French security agent working for the European Union was shot dead in the capital on Monday. Security forces staged raids on suspected militants across the capital on Wednesday and shot dead the man they said was responsible for the Frenchman's killing and for a number of other attacks on Westerners.
Citing recent attacks against Western interests in Yemen, the United States closed its embassy in Sanaa to the public.
The New York Times reported on Friday that two weeks ago, a United States Special Operations commando and a CIA officer shot and killed two armed Yemeni civilians who tried to kidnap them in a barber shop in Sanaa.
The paper, quoting two U.S. senior officials, said the two Americans were whisked out of the country just days after the shooting, with the blessing of the Yemeni government.
Yemeni security forces also arrested two French men believed to be members of an al Qaeda cell in Yemen, an official security source told Reuters on Friday. Paris confirmed that two of its citizens had been detained.