* Second attack in as many days near presidential palace
* Follows big army offensive against al Qaeda in south Yemen
* Military police building attacked in south (Adds eyewitnesses, another attack)
By Mohammed Ghobari
SANAA, May 11 (Reuters) - Three gunmen were killed after they tried to attack a security checkpoint in the Yemeni capital early on Sunday, the interior ministry said, the second such incident close to the presidential palace in Sanaa in as many days.
The attack appeared to be retaliation for an army offensive against al Qaeda that has ousted many militants from bastions in south Yemen first seized during mass unrest in 2011, endangering national security and oil-exporting Saudi Arabia next door.
Sunday's clash came two days after a gunfight near the palace and what appeared to be an assassination attempt on the defence minister in the southern province of Shabwa.
"Three terrorists were killed at dawn today in a new attack that targeted a security checkpoint," the interior ministry said in a statement, adding that a fourth gunman was wounded and a civilian bystander was also killed.
Residents heard gunshots in the area early on Sunday and said the military had deployed extra soldiers to secure surrounding roads since the attack.
"We heard heavy gunfire near the central intelligence building which is on the road leading to the presidential palace," one resident said.
"It lasted for several minutes then stopped and two hours later we heard heavy firing when we wanted to go to work," the resident said, adding that roads had been closed off.
To the southeast, in the city of Mukalla, residents heard an explosion on Sunday near a military police building and saw ambulances transporting wounded people. There were no immediate details of casualties.
Late on Saturday, a bomb exploded close to the house of Yemeni President Abd Rabbu Mansour Hadi in the southern port city of Aden, a security source said. No one was wounded and there was no damage to Hadi's home.
Keen to stem a stubborn Islamist insurgency that has targeted security forces, military facilities and foreigners, Yemen's army went after the militants last month in the provinces of Shabwa and Abyan.
The army, which conducted a similar, ultimately ineffective campaign against al Qaeda in 2012, has pledged to continue to pursue militants who had retreated from towns in Shabwa and Abyan into the rugged desert hinterland. State news agency Saba reported the killings of seven militants on Saturday.
Western powers are concerned that al Qaeda in the Arabian Peninsula (AQAP) could use Yemen, which neighbours top oil power Saudi Arabia, as a springboard for future international attacks. (Additional reporting by Mohammed Mukhashaf; Reporting by Mohammed Ghobari; Writing by Yara Bayoumy; Editing by Rosalind Russell)