An allegedly new Islamic State affiliate in Saudi Arabia claimed responsibility for a suicide bombing at a mosque inside a police compound in the country's southwest on Thursday that killed at least 15 people, most of them members and recruits of the kingdom's special forces.

It was the deadliest attack against Saudi security personnel in years and one that is likely to pull the kingdom deeper into the regional war with IS extremists.

The blast took place in an Interior Ministry compound in the city of Abha, the provincial capital of Asir, which lies along the border with war-torn Yemen. The troops killed were members of an elite counter-terrorism force.

The attack was stunning in its timing and target, coming just weeks after the Saudi Interior Ministry announced the arrest of more than 400 suspects in an anti-terrorism sweep. In April, they announced the arrest of more than 90 suspects.

The kingdom had for years quietly allowed thousands of Saudis to leave the country to join militant groups fighting in Iraq and Syria, until the late King Abdullah last year decreed that fighting abroad was illegal. At the same time, Saudi Arabia joined a U.S.-led coalition carrying out airstrikes in Syria and Iraq against the Islamic State group.

The kingdom is also leading a coalition targeting Yemen's Iran-allied Shiite rebels who have carried out a number of cross-border attacks against Saudi military targets. It has also sheltered Yemen's exiled President Abed Rabbo Mansour Hadi whose loyalists at home are battling Iran-backed Shiite rebels known as Houthis.

Hours after Thursday's bombing in Abha, a previously unheard of IS affiliate, which calls itself Hijaz Province of the Islamic State, claimed responsibility for the attack.

The group issued a statement saying an IS suicide bomber targeted a "monument of the apostate," referring to the special forces' compound in Abha. It described the kingdom's ruling family as "tyrants" who have aligned themselves with "their Crusader masters," or Western allies. The statement was carried on IS-affiliated Twitter accounts and was also reported by the SITE Intelligence Group, which tracks militant messages.

The claim was the first by the purportedly new IS branch.

The "Hijaz" in its name is a reference to the historic western part of Saudi Arabia that is home to Islam's holiest sites of Mecca and Medina. The name raises the specter of future assaults in this part of Saudi Arabia, which has not seen terrorist attacks in recent years.

Another local IS affiliate calling itself Najd Province — a reference to the central Saudi region that's home to the capital, Riyadh — has claimed responsibility for recent attacks in eastern Saudi Arabia and also in Kuwait.

Saudi Interior Ministry spokesman, Maj. Gen. Mansour al-Turki, told The Associated Press it was too early to confirm whether IS or its supporters were behind Thursday's attack and that the police were still investigating.

Local reports suggested the bomber entered the police compound disguised as a janitor, but al-Turki said this has also not been confirmed.

The U.S. ambassador to Riyadh, Joseph Westphal, condemned the attack "in the strongest terms" and said in a statement that his "heart is with the families" of the victims.

The last major attack against Saudi security forces was in April 2004, in the midst of Saudi Arabia's battle against a wave of Al Qaeda attacks, when a car bombing hit an Interior Ministry building in Riyadh. That attack killed four security personnel and a civilian.

Retired Royal Saudi Navy Commodore Abdulateef Al-Mulhim said Thursday's bombing was "devastating" but could prompt Saudi forces, especially the younger recruits — some of whom were targeted in Abha — to be "more careful, more watchful."

"They will take (this) threat very, very seriously and take their training very, very seriously," he said.

State TV carried images of the aftermath of the attack, showing blood splattered on the mosque walls and ceiling and debris scattered about. The governor of Asir, Prince Prince Faisal bin Khaled bin Abdulaziz, was shown visiting wounded troops at the hospital.

Saudi Interior Minister and Crown Prince Mohammed bin Nayef cut short a visit to Egypt, where he was to attend the inauguration of an extension of the Suez Canal on Thursday, to return to Saudi Arabia following the news of the attack.

Despite the emergence of now two IS affiliates in Saudi Arabia, security officials in the kingdom insist they are better prepared than ever to face the new generation of militants.

The Saudi government has over the past decade set up a groundbreaking center to de-radicalize militants after their time in prison, as well as an Interior Ministry department to counter extremist ideology and increased defense and security spending.

IS leaders have also changed tactics in recent months, calling on Saudi followers to stay in the country and fight the Western-allied monarchy instead of joining militants in Syria and Iraq.

Before Thursday's attack, at least 40 Saudi civilians and security personnel were killed in various IS attacks since November.

The IS affiliate known as Najd Province has carried out drive-by shootings targeting Saudi police at checkpoints in Riyadh and claimed to be behind two bombings in Saudi Arabia's east — one in May that killed 22 people inside a Shiite mosque and another a week later that killed four just outside a Shiite mosque.

The same group also claimed responsibility for Kuwait's deadliest terrorist attack, which killed 27 Shiite worshippers in June.