Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

RIYADH, Saudi Arabia — A top Saudi official has insisted there are differences between the country’s practice of public beheadings and the executions carried out by ISIS militants.

Interior Ministry spokesman Maj. Gen. Mansour al-Turki told NBC News that Saudi criminal punishments were legitimate because they were based on "a decision made by a court" rather than ISIS’ "arbitrary" killings.

Saudi Arabia — one of America’s closest allies in the Middle East — has endured sustained criticism by human rights groups for its justice system based on hard-line Islamic law, its lack of political freedom and policies toward women.

In an interview with NBC News, al-Turki defended the nation's public beheading of convicted criminals. "When we do it in Saudi Arabia we do it as a decision made by a court," he said. "The killing is a decision, I mean it is not based on arbitrary choices, to kill this and not to kill this."

ISIS regularly hands down brutal sentences based on Shariah law.

Al-Turki said that "ISIS has no legitimate way to decide to decide to kill people," adding that "the difference is clear."

"When you kill somebody without legitimate basis, without justice system, without court, that is still a crime whether you behead them or kill [them] with a gun," al-Turki said, referring to ISIS' killings.

Saudi Arabia came under increased scrutiny by the United Nations and human rights groups last year after the kingdom upped its rate of executions to one per day in August.

A execution square used for executions near the religion police building (right) in Riyadh, Saudi Arabia. Peer Grimm / Picture-Alliance via AP file

The U.N. said beheading was "prohibited under international law under all circumstances" and alleged Saudi Arabia was carrying out executions "with appalling regularity and in flagrant disregard of international law standards."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The oil-rich kingdom executed at least 68 people last year for offenses such as drug trafficking and one case of "sorcery," according to Human Rights Watch. Death Penalty Worldwide, a database run by Cornell University that has received funding by the European Union, said that "sources suggest" public beheading was the country’s most common form of execution.

In 2013, the country carried out the fourth most executions in the world (79), according to Amnesty International, twice as many as the United States (39) and surpassed only by Iraq, Iran and China.

Recent cases include an alleged rapist who was beheaded in Jeddah on Monday despite controversy over the evidence against him.

Al-Turki said international outrage over ISIS beheadings was driven mainly by "why ISIS kills people" rather than "the way ISIS kills people."

"When you look at the number of Saudis being involved in extremist groups, it does not represent the Saudi population"

He said it was a "crime" when you kill somebody "without legitimate basis, without a justice system," which he argued was always exercised by the absolute monarchy of Saudi Arabia.

However, the U.N. took a different view when it made a plea for the kingdom stop such executions in September. It said trials in the country were "by all accounts grossly unfair," with defendants not allowed lawyers and death sentences imposed after confessions during torture.

Al-Turki said security would be a major focus for King Salman, who took the throne upon the death of his half-brother Abdullah last month.

"We are very much determined actually to secure our country, secure our people and defeat terrorism inside Saudi Arabia and help the international effort to defeat it everywhere else," he said.

Al-Turki said Saudi Arabia was the “first country in the world” to call for international cooperation on terrorism.

He told NBC News that Saudi Arabia had employed tough new measures to stop its citizens from funding terror groups. “Saudi Arabia is not a financial bank to the terrorist organizations,” he said, adding that the government was working with financial corporations to highlight suspicious transactions.

Al-Turki added that 205 people were arrested in 2014 under terrorism laws, including 99 allegedly linked to four attacks in the country since July which have left 17 people dead.

"We have done a great job actually on improving the public awareness of al Qaeda and ISIS and their goals ... and how they [have] deviated actually from the religion of Islam," al-Turki said. "In many situations for example, in cooperation with families, we have been able to prevent many young people from leaving Saudi Arabia to join extremist groups."

According to al-Turki, about 2,200 Saudis have traveled to Syria to join militant groups in the past four year but 630 have since returned.

"One year ago, we had a royal decree to punish anyone who would join extremist groups or support them or aid them in any way," he said. "Such people will be prosecuted and eventually ... they will go to jail with a minimum sentence of three years. Some might stay in prison for a longer period."

The Interior Ministry spokesman added: "When you look at the number of Saudis being involved in extremist groups, it does not represent the Saudi population. We are 22 million people and we have only 2,200 Saudis [joining] ISIS in four years."

Alexander Smith reported from London.