LONDON — Pakistani officials said Friday that a court had released eight of the 10 men accused of conspiring in the shooting of the schoolgirl activist Malala Yousafzai, in an admission that brought new scrutiny of Pakistan’s faltering efforts to try Islamist militants in the courts.

The men had been charged with organizing the 2012 attack on Ms. Yousafzai, who was shot in the head as she traveled to school in the northwestern Swat Valley. She survived her injuries and went on to become a global symbol of defiance and an advocate for the education of girls, winning the Nobel Peace Prize in December.

Although the Taliban gunmen were believed to have fled to neighboring Afghanistan, the authorities announced the arrest of 10 men and put them on trial in April at a military-run internment center in Swat. The media and the public were barred from the hearings.

When the trial ended on April 30, a prosecutor told reporters that all 10 had confessed to a role in the attack, and the police said they had been convicted and imprisoned for 25 years each.