Saudi Arabia said a suicide bomber who attacked Prophet Mohammed's Mosque in the city of Medina on Monday was a 26-year-old Saudi citizen with a history of drug abuse.
Twelve Pakistanis and seven Saudis have been detained in relation to attacks that day.
Naer Muslim Hamad crossed a parking lot next to the prophet's mosque in Medina and detonated an explosive belt near a security headquarters, killing four soldiers, the state news agency SPA quoted an Interior Ministry spokesman as saying.
"When security guards intercepted him he blew himself up," said the spokesman.
The statement also named three individuals who carried out bombings in the province of Qatif on Monday. It said none of them had obtained Saudi IDs. All of the men were in their early 20s and one had previously taken part in anti-government rallies.
Suicide bombers hit three Saudi cities on Monday in apparently coordinated attacks that targeted U.S. diplomats in Jeddah and Shi'ite Muslim worshippers in Qatif, jolting the kingdom as people prepared to break their fast on the penultimate day of the holy month of Ramadan.
A Saudi Interior Ministry spokesman told Al-Ikhbariya TV that the Medina bomber had traveled outside the country several times, most recently early this year. He said nitroglycerin from the blasts in Qatif and Medina seemed to match those found at the Jeddah attack suggesting they may have been coordinated.
The United Nations human rights chief described the bombing outside the Prophet Mohammed's Mosque in Medina as "an attack on Islam itself".
No group has claimed responsibility but Islamic State militants have carried out similar bombings in the U.S.-allied, Sunni Muslim-ruled kingdom in the past year, targeting minority Shi'ites and Saudi security forces.
Militant attacks on Medina are unprecedented. The city is home to the second most sacred site in Islam, a mosque built in the 7th century by the Prophet Mohammed, the founder of Islam, which also houses his tomb.
The Al Saud ruling family considers itself the protector of both sites. Islamic State has said the Saudi rulers are apostates and has declared its intention to topple them.
Monday's attacks highlighted how young Saudi men are being drawn to Islamic State, which has launched attacks on Shi'ites in smaller Gulf Arab states and stepped up violence in the holy fasting month of Ramadan.
King Salman, in a speech on Tuesday marking Eid al-Fitr, the holiday that celebrates the end of the Islamic holy month of Ramadan, said a major challenge facing Saudi Arabia was preserving hope for youth who faced the risk of radicalization.
Salman said his country would strike with an "iron hand" against people who preyed on youth vulnerable to religious extremism.
Saudi security officials have said Islamic State supporters inside the kingdom mainly act independent of the group in Iraq and Syria, its main areas of operation.