ISLAMABAD, Pakistan — Gunmen shot to death the Pakistani government’s top prosecutor Friday morning in a case that accuses former military ruler Pervez Musharraf of involvement in the 2007 assassination of ex-Prime Minister Benazir Bhutto, police said.

The gunmen opened fire on Chaudhry Zulfikar’s car as he was leaving his home en route to an antiterrorism court in nearby Rawalpindi. The shooters used either a taxi or motorbike in the attack, police said in conflicting reports.

The assailants escaped, and authorities said the motive for the attack was not known.

‘‘The police are not aware of any threats being received by the state prosecutor,’’ said Irshad Abro, a senior police official.

FAROOQ NAEEM/AFP/Getty Images

Chaudhry Zulfikar was involved in a number of high-profile cases.

Zulfikar’s slaying was a rare episode of violence in the capital, which has so far seen none of the bombings or other attacks launched by the Taliban against secular politicians.

The group has warned people not to vote in the May 11 national election — which will bring the first transfer of power between elected governments in Pakistan’s 65-year history — saying it is against Islamic law.

In January 2011, Salman Taseer, the governor of Punjab province, was assassinated by his bodyguard at an upscale market.

In May 2011, an Islamabad-based investigative reporter, Saleem Shahzad, mysteriously disappeared; his body was found about 100 miles away in a still-unsolved killing that US officials linked to the Pakistani intelligence service.

Musharraf, who ruled Pakistan for nine years before going into self-exile in 2008, returned in March in an ultimately futile bid to run for prime minister. He has been under house arrest for more than two weeks, facing allegations in various cases linked to his tenure.

In the case unfolding in Rawalpindi, prosecutors allege that Musharraf was culpable for Bhutto’s murder for not providing her with enough security. He has denied the allegations.

At the time, Musharraf’s government blamed the Taliban for the fatal attack on Bhutto, a two-time prime minister. Bhutto’s son, Bilawal, who now leads the Pakistan People’s Party, has alleged that Musharraf was behind it.

Proceedings in the case have been bogged down for years, and resumed only recently with Musharraf’s return.

Speculation was rife Friday that Zulfikar was killed to disrupt that case, but, as is common in Pakistan, that was just one conspiracy theory among many.

‘‘The head of the prosecution service is going to be leading any number of sensitive cases at any one time,’’ said Salman Akram Raja, a noted lawyer.

Although reluctant to engage in what he called ‘‘pure speculation,’’ Raja offered this: ‘‘Maybe it was to send a signal that whoever was behind Benazir’s assassination, that they are still around.’’

Zulfikar also headed the prosecution of Pakistani militants accused in the three-day massacre in Mumbai that killed 166 people, including six US citizens.

Indian and US authorities blamed that attack on Lashkar-e-Taiba, a Pakistan-based group they allege is headed by Lahore religious scholar and cleric Hafiz Mohammad Saeed, who has denied involvement.

The trial of the seven men suspected in the Mumbai attack has dragged on for years, as well. Pakistani courts have repeatedly refused to accept evidence from Indian authorities.

Saeed continues to preach freely and has the backing of the Pakistani government and courts, which both say there is no credible evidence tying him to the Mumbai operation.

Pakistan’s main military intelligence agency helped create Lashkar-e-Taiba to wage attacks on Indian forces in the disputed territory of Kashmir, but it now disavows any control over or connection to the group.

Musharraf, a retired four-star general who also served as president, is also facing treason charges in a Supreme Court case connected to the dismissal and arrest of scores of senior judges as part of his bid to hold onto power late in his tenure.

Friday’s assassination of the prosecutor took place in a middle-class neighborhood.

Police said Zulfikar suffered multiple gunshot wounds to the chest and head and died on the way to a hospital. His bodyguard was also severely injured.

A woman on the scene was killed when hit by Zulfikar’s car after it came under fire from the attackers, police said.