* Gunmen fail to assassinate defence minister, also attack palace
* Under pressure in countryside, militants raise threat to capital
* Western countries fear fresh plot against airliners (Adds Sanaa colour, defence ministry, state news agency statements)
By Mohammed Ghobari
SANAA, May 9 (Reuters) - 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 was 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.
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.
Since late April the government has stepped up its campaign against the Yemeni group considered al Qaeda's most active unit, al Qaeda in the Arabian Peninsula (AQAP), driving it from some of its strongholds in the south.
The push followed air strikes against AQAP in April that the government said had killed at least 55 militants, the biggest against al Qaeda since at least 2012.
The militants have claimed attempted bombings of Western airliners and carried out dozens of bomb and suicide attacks and commando-style raids against military installations, government facilities and foreign nationals.
Saudi Arabia also watches AQAP with concern, since the branch was founded by citizens of both countries and has sworn to bring down the ruling al-Saud family.
In a separate incident on Friday, four soldiers were killed in an ambush by suspected al Qaeda fighters in the central province of al-Bayda, tribal sources told Reuters.
In Sanaa, a security source said a vehicle carrying a number of armed militants suspected to be linked to al Qaeda attacked the main gate of the palace.
"Four soldiers at the palace were killed by the militants," the source said.
"There was a gunfight that lasted about 45 minutes and then a few of the militants managed to escape with their car," the source said, adding that there were casualties on both sides.
Security forces in the area were looking for the militants in a nearby public garden, the source said.
The insurgents have posed a challenge to government efforts to restore stability to the U.S.-allied country since veteran president Ali Abdullah Saleh was forced to step down in 2012 after months of pro-democracy protests.
Western countries fear that further destabilisation in Yemen, whose government is also being challenged by separatists in the south and unrest in the north, could give more space to AQAP to plot attacks on international targets.
(Additional reporting by Yara Bayoumy; Writing by Amena Bakr and William Maclean; Editing by Robin Pomeroy)
Our Standards: The Thomson Reuters Trust Principles.