* The two were part of group of six who attacked border post
* Saudi Arabia, which faced a militant threat 10 years ago, targeted again
* Saudi says militants had been given a chance to surrender (Updates with Interior Ministry spokesman's news conference, in paragraphs 4-6, 10)
By Sami Aboudi
DUBAI, July 5 (Reuters) - Two suspected al Qaeda militants blew themselves up on Saturday after being trapped inside a government building in southern Saudi Arabia, the Interior Ministry said, following an attack on a border post with Yemen that also killed four security men.
An Interior Ministry spokesman said the two were part of a group of six al Qaeda militants who attacked the Wadia border post on Friday from Yemen. Three of them were killed on Friday and a fourth was captured after being injured.
Saudi Arabia, the world's biggest oil exporter, has long viewed its 1,800 km (1,100 mile) border with impoverished, conflict-ridden Yemen as a major security problem and has been building a fence to deter militants and criminals.
The Interior Ministry spokesman, Mansour al-Turki, said security forces surrounded the two men on the second floor of the local intelligence service building in al-Sharurah area after they had forced their way into the building on Friday. The militants, who Turki said had been identified as people wanted by the authorities, declined a chance to surrender.
"At an early hour this morning ... the two attackers resorted to blowing themselves up," Turki said in remarks carried by the state news agency SPA.
"The attackers made no demands, nor heeded appeals by security men" to surrender, he told a news conference later in the day.
Saudi-owned al-Arabiya television earlier reported that the militants had put up "stiff resistance" to security forces surrounding them, firing automatic weapons and hurling grenades at security forces.
Saudi Arabia has been wary of potential al Qaeda infiltration across its northern border from Iraq, where militants have swept through the Sunni Muslim heartland close to the border with Saudi Arabia.
To the south, Al Qaeda in the Arabian Peninsula (AQAP) has been waging a campaign of attacks on Yemeni government targets, raising fears the violence could spill across the border to Saudi Arabia.
"The kingdom as a whole is targeted, not only the crossing points," Turki told journalists, adding that Saudi Arabia would not allow what he called the deviant group - a reference to al Qaeda - to achieve its goals.
Saudi Arabia, which overcame its own al Qaeda insurgency almost a decade ago, said in May that it had detained 62 suspected al Qaeda militants with links to radicals in Syria and Yemen. It said it believed they were plotting attacks on government and foreign targets in the kingdom.
Turki said Friday's attack began when six militants in a car with licence plates from an unspecified Gulf Arab country arrived at the Wadia checkpoint in the Empty Quarter desert area, which links Yemen's Hadramout province with Saudi Arabia.
The militants shot and killed the commander of a Saudi border patrol and seized his car. They made their way inside Saudi territory towards al-Sharurah.
Security forces engaged the militants in the second car, killing three and capturing the fourth. The militants also killed two other security men during the clash, Turki said.
Saudi media had earlier said the six were all Saudi nationals. Turki said authorities were conducting tests to determine the identities of the militants.
Yemen's state news agency Saba earlier reported that a suicide bomber drove a car laden with explosives into the Yemeni side of the Wadia border crossing, killing himself and one soldier and wounding another.
After the attack, Yemeni security forces chased militants who fled from the scene in two cars into the desert, Saba said, citing a military source.
A Yemeni official, apparently referring to the same incident, earlier told Reuters the gunmen had escaped into Saudi Arabia after attacking the Yemeni border post.
The official said the attackers were al Qaeda militants.
Hadramout province stretches through arid valleys and empty desert - a landscape that al Qaeda militants use to their advantage across the Middle East.
Saudi Arabia's construction of the security fence along its border with Yemen has often been interrupted by protesting tribesmen who say it prevents them accessing pastures for their livestock. (Reporting by Mostafa Hashem and Ali Abdelatti,; Writing by Sami Aboudi; Editing by Ralph Boulton and Mohammad Zargham)
Our Standards: The Thomson Reuters Trust Principles.