Two Saudi Arabian border guards were killed on Monday in an ambush in Sharurah in the far south of the country, near its border with Yemen, Al Arabiya television said.
An Al Arabiya correspondent said that 10 of the attackers were previously jailed on terrorism charges.
Saudi border guards have in the past also clashed with smugglers along the long, porous desert frontier.
The ten Saudi militants who were recently released from prison, in addition to a Yemeni, were all arrested after they ambushed a border guard patrol and killed two soldiers, the ministry said.
"Security forces were able to pursue those assailants as they attempted to cross the Saudi border into Yemeni territory," the ministry said in a statement carried by SPA state news agency, adding that four gunmen were wounded in a firefight.
The ministry said the gunmen ambushed the patrol at dawn.
"All those arrested among the Saudi (militants) had been arrested in the past over links with the deviant group," the ministry said.
It said they were "recently released" from prison.
Al Arabiya has released the names of the dead border guards: Fahd bin Hussein Fahd Alhmanda and Mohammed bin Hassan Ali.
The names of the attackers are:
1 - Nhad Khaled Ayed Al-Otaibi
2 - Mohammed Faraj Solomon Anzi
3 - Khalil Hassan Yahya al-Zahrani
4 - Bandar Daij Harbi
5 - Abdullah Saad Mohammed
6 - Mohamed Salem Awad Sayari
7 - Fahd Mohammed Hamoud al-Bakri
8 - Ali Abdullah Saleh
9 - Issa Awad Ghazi Al-Otaibi
10 - Khalid Faisal Needless Otaibi
Sharurah is a small town in Najran Province, southern Saudi Arabia, approximately 200 miles east of the town of Najran.