DUBAI, United Arab Emirates (AP) — Saudi Arabia on Tuesday beheaded 37 Saudi citizens in a mass execution across the country for what it described as terrorism-related crimes, publicly pinning one of the bodies and its severed head to a pole as a warning to others.

It marked the largest number of executions in a single day in Saudi Arabia since Jan. 2, 2016, when the kingdom executed 47 individuals in what was the largest mass execution carried out by Saudi Arabia since 1980. Among those executed three years ago was prominent Shiite cleric Nimr al-Nimr, whose death sparked protests from Pakistan to Iran and the ransacking of the Saudi Embassy in Tehran. Saudi-Iran ties have not recovered and the embassy remains shuttered.

King Salman ratified by royal decree Tuesday's mass execution and that of 2016. The king, who has empowered his son Crown Prince Mohammed bin Salman, has asserted a bolder and more decisive leadership style than previous monarchs since ascending to the throne four years ago.

This latest mass execution comes on the heels of Sri Lanka's Easter Day attacks that killed over 300 people, including two Saudi nationals. The attack was claimed by the Islamic State group.

Also, on Sunday four Islamic State gunmen were killed by Saudi security forces while trying to attack a security building north of the capital, Riyadh.

Saudi Arabia's Interior Ministry said Tuesday's executions were carried out in accordance with Islamic law, using language that indicated they were all beheadings. Saudi Arabia's supreme council of Muslim scholars also issued a statement saying the executions were carried out in accordance with Islamic law.

The Interior Ministry said the body of one of the men — Khaled bin Abdel Karim al-Tuwaijri — was publicly pinned to a pole for several hours in a process that is not frequently used by the kingdom and has sparked controversy for its grisly display. The statement did not say in which city of Saudi Arabia the public display took place.

The government defends such executions as a powerful tool for deterrence.

The Interior Ministry statement said those executed had adopted extremist ideologies and formed terrorist cells with the aim of spreading chaos and provoking sectarian strife. It said the individuals had been found guilty according to the law and ordered executed by the Specialized Criminal Court in Riyadh, which specializes in terrorism trials, and the country's high court.

The individuals were found guilty of attacking security installations with explosives, killing a number of security officers and cooperating with enemy organizations against the interests of the country, the Interior Ministry said.

The statement was carried across state-run media, including the Saudi news channel al-Ekhbariya. The statement read on the state-run news channel opened with a verse from the Quran that condemns attacks that aim to create strife and disharmony and warns of great punishment for those who carry out such attacks.

A number of Saudi analysts and pro-government writers brought in to discuss the executions on al-Ekhbariya said they are a powerful sign that the country's leadership will not hesitate to use the full might of the judicial system to punish Saudis who seek to disrupt the kingdom's security.

Those executed hailed from Riyadh, Mecca, Medina and Asir, as well as Shiite Muslim populated areas of the Eastern Province and Qassim. The executions also took place in those various regions.

The statement named all those executed, which included several individuals from large conservative Sunni tribes and families in Saudi Arabia.

The executions bring the number of people executed since the start of the year to 95, according to official announcements. Last year, the kingdom executed 125 people, most of them drug smugglers convicted of non-violent crimes.

Executions are traditionally carried out after midday prayers. Public displays of the bodies of executed men last for around three hours until late afternoon prayers, with the severed head and body hoisted to the top of a pole overlooking a main square.

Saudi Arabia has been a target of extremist attacks over the years. The most stunning, however, was the 1979 siege of the mosque housing Islam's holiest site in Mecca.

The kingdom also faced a wave of al-Qaida attacks more than a decade ago, but its security forces crushed the group inside the kingdom before it built a presence in Yemen and became known as al-Qaida in the Arabian Peninsula.

In recent years, local affiliates of the Islamic State group and Saudis inspired by its ideology launched attacks in Saudi Arabia, killing dozens of people, including security officers and Shiite worshippers. The last major attempted attack is believed to have been in 2016.

The group, like al-Qaida in the past, is determined to bring down the U.S.-allied royal family of Saudi Arabia. It has sought to undermine the Al Saud royal family's legitimacy, which is rooted in part in its claim to implement Islamic Shariah law and to be the protectors of Islam's most sacred sites in Mecca and Medina that are at the center of hajj.

Some 2,500 Saudis, many of them young and well-educated , fought in Syria at the start of that country's civil war before the kingdom criminalized fighting abroad in early 2014. More than 650 returned during an amnesty period, disillusioned with fighting.

___

Associated Press writer Sam Magdy contributed from Cairo.

___

Story has been corrected to say that one, not two, bodies were publicly displayed