Islamabad, Pakistan - A bomb explosion targeting a senior politician in southwestern Pakistan has killed at least 25 people and wounded 37 others, medical officials say.

The blast took place in the town of Mastung, about 50km south of Balochistan provincial capital Quetta, shortly after the end of Friday prayers, according to a government spokesman.

Senate Deputy Chairman Abdul Ghafoor Haideri escaped the attack with light wounds, medical officials said, but his driver and another aide in the same vehicle were killed.

"He was wounded by the blast but someone who was sitting next to him, and his driver were both killed," said Dr Sher Ahmed, the government's district health chief in Mastung, while confirming the death toll.

Haideri received "light wounds from broken glass", according to Dr Shafi Zaidi, chief of the local hospital where the senator was initially treated.

Later on Friday, the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) armed group claimed responsibility for the attack, in a statement released by its Amaq website. It said the attack had been carried out by a suicide bomber wearing an explosive vest.

At least 37 people who received serious wounds from the blast were transferred to Quetta, said Dr Ahmed. They mainly suffered from shrapnel wounds, he said.

Television footage from the scene showed several badly damaged vehicles and motorcycles, with windscreens shattered and severe blast damage visible, as the police established a cordon around the site.

Haideri himself spoke to local media over the phone while en route to the hospital, saying he was not badly wounded.

"I am fine, thank God. I have been wounded. I am being taken to the [Combined Military Hospital in Quetta]," Haideri told Pakistan's Geo News television channel.

"The explosion happened on my car ... the glass from the front windscreen hit me, and the side door also buckled after the blast," he added.

Anwar ul-Haq Kakar, spokesman for the Balochistan provincial government, told Al Jazeera that the attack occurred when Haideri was leaving a mosque after Friday prayers.

"As soon as they started the journey back there was an explosion," Kakar said.

"Law enforcement personnel are collecting evidence at the site and examining the crime scene. It would be premature to say what kind of blast it was at this stage."

Haideri is a member of the right-wing religious Jamaat Ulema Islam party's Fazl faction (JUI-F), and has been a senator since 2008. He has been the deputy chairman of the Senate since 2015.

He has previously represented his native district of Kalat, also in Balochistan, in the lower house of parliament.

In February, Pakistan's Senate boycotted a UN-sponsored event in the United States in protest against an "undue delay" by the US in issuing a visa to Haideri to attend.

Asad Hashim is Al Jazeera's web correspondent in Pakistan. He tweets @AsadHashim.