ISLAMABAD, Pakistan — In a surprise development, a terrorism court in Pakistan on Thursday acquitted five suspected Taliban and Al Qaeda militants in the 2007 assassination of former Prime Minister Benazir Bhutto and declared the former leader Pervez Musharraf a fugitive in the case, lawyers said.

The release of the five militants was met with shock and disappointment by senior officials of Ms. Bhutto’s political party, the Pakistan Peoples Party, which called the court’s decision “a triumph of Taliban and Al Qaeda.”

Ms. Bhutto, a charismatic leader who had served twice as prime minister in the 1990s, was killed in a gun and bomb attack in 2007 in Rawalpindi, the garrison city neighboring the capital, after she finished addressing a political rally. Her assassination plunged the country into political chaos and spasms of violence.

Pakistani investigators arrested five suspected militants, accusing them of facilitating in the assassination, and indicted them in 2011. Mr. Musharraf, a political adversary of Ms. Bhutto’s, was indicted in 2013 on charges of murder and conspiracy amid allegations that his government had not provided her with adequate security.