Two suicide bombers attacked a church in Pakistan where hundreds of worshippers were attending service ahead of Christmas, killing at least nine people and injuring dozens of others, officials said.

One of the suicide bombers was shot dead outside Bethel Memorial Methodist Church in Quetta, but the other assailant made it to the church's entrance hall as Sunday services opened, said Sarfaraz Bugti, home minister for the southwestern Baluchistan province. The gunman — who didn’t gain access to the main building — opened fire at the churchgoers before detonating his explosive vest.

“There were nearly 400 people inside the church, but the attackers couldn’t get inside the services,” provincial police chief Moazzam Jah told Reuters. “We killed one of them, and the other one exploded himself after police wounded him,” he said.

The Islamic State group later claimed responsibility for the attack on their Aamaq news agency, saying two "plungers" from their group had stormed the church, without providing further details.

The death toll in the deadly attack rose to nine people, including two women, by Sunday afternoon. Five women and two children were among the 57 people hurt. Seven people were listed in critical condition, said Wasim Baig, a spokesman for Quetta's main hospital.

Aqil Anjum, who was shot in his right arm, told The Associated Press he heard a blast in the middle of the service, followed by heavy gunfire.

"It was chaos. Bullets were hitting people inside the closed hall,” Anjum said.

Authorities were hunting for two suspected accomplices who escaped the scene, Quetta police chief Abdur Razzaq Cheema said.

The church was placed on high alert for a possible attack because Christian places of worship are often targeted by Islamist extremists during Christmas time, Reuters reported.

Baluchistan Police Chief Moazzam Ansari credited the security forces guarding the church for taking down one of the attackers.

"Otherwise the loss of lives could have been much higher," he told reporters.

It was the first time the Islamic State group has claimed an attack on a church in Pakistan, though Muslim extremists have claimed church attacks in the past. The deadliest example was in September 2013, when twin suicide bomb blasts killed 85 people in a Peshawar church. In March 2015, two suicide bombers attacked two churches in the eastern city of Lahore, killing 15 people.

Pakistan's president and other senior officials condemned the attack.

The Associated Press contributed to this report.