A soldier repairs barbed wire fencing while contractors await a helicopter flight at Bagram Air Base in Afghanistan. The U.S. is closing the last detainee site in the country as troop pullout nears. (Lucas Jackson/Reuters)

The United States closed its last detention facility in Afghanistan and transferred all remaining prisoners to Afghan custody, U.S. officials said Thursday, ending a controversial chapter in America’s war against terrorism.

But attacks in Afghanistan’s capital and other parts of the country Thursday underscored the extent to which much of the conflict remains unfinished, even as most international troops pull out at the end of the month.

A suicide bomber killed six Afghan soldiers and wounded 14 traveling in a military minibus in the first assault in Kabul in more than a week, officials said. Hours later, a teenage suicide bomber struck during an event at a French-run school in the capital. Afghan officials said at least one person was killed and more than 20 were injured in the attack.

French Foreign Minister Laurent Fabius called the attack at the school “barbaric.” He said in a statement: “I firmly condemn this terrorist act which caused the death of several people and left many injured. There were no French victims.”

The attack at Istiqlal School, home to the French Cultural Center, unfolded during a performance of a play called “Heart Beat,” a production about democracy and freedom. Officials said that about 500 people were in the auditorium and that the bomber apparently was in the audience.

“The suicide bomber was a boy between 15 to 16 years old who had probably hidden the explosives in his underwear,” said Abdul Rahman Rahimi, Kabul’s police chief.

A reporter for the television network Tolo News witnessed the attack and described it in a broadcast: “While I was filming the show, I suddenly heard a huge sound. I saw dead bodies and wounded people around me, and they were crying for help. But there wasn’t anyone to help them. Everyone was running away from the hall.”

There were also clashes between Afghan security forces­ and Taliban insurgents in the central market of Shindand district in western Herat province. Insurgents also fired a rocket at Bagram air base, where U.S. troops are based. But it fell into a field and caused no casualties, said Gen. Zaman Mamozai, the police chief in Parwan province, north of Kabul.

The Afghan capital has been on edge since last month after a series of attacks killed several foreigners, including a South African aid worker and his two children as well as two U.S. soldiers. Taliban insurgents unsuccessfully tried to assassinate Kabul’s then-police chief and an outspoken women’s activist.

Thursday’s attacks, which occurred after a brief lull in the violence, came a day after Afghan President Ashraf Ghani publicly expressed shock at a U.S. Senate report’s scathing revelations about the CIA’s interrogation tactics, allegedly also employed against many Afghans. At a news conference, Ghani stressed that a recent bilateral security pact between Kabul and Washington did not allow Americans to run prisons or arrest people in Afghanistan.

On Thursday, American officials said the last remaining U.S. prisoner facility at Bagram has been shut down, severing another link to post-9/11 sites detailed in the Senate report. At one point, hundreds of detainees from different countries were held there. The officials said the decision to close the facility did not stem from the CIA report but was part of the effort to scale down the U.S. military mission by the end of the year.

“The closure of our detention facilities was an explicit provision of the Bilateral Security Agreement, which states the United States shall not maintain or operate detention facilities in Afghanistan,” said Col. Brian Tribus, a spokesman for the International Security Assistance Force, the NATO-led mission in Afghanistan. “The recent transfers of detainees was due to this legal requirement and was not linked to the release of the Senate committee report on detention and interrogation.”

The closure of the prison came after the transfer of detainees to other countries or into Afghan custody, including Tunisian Redha al-Najar. He was captured in May 2002 on suspicion of being a bodyguard of Osama bin Laden. Najar and another Tunisian were held at one of the secret CIA facilities described in the Senate report, which was released Tuesday.

It’s unclear whether the last detainees transferred from the Bagram facility will face trial before an Afghan court. In his remarks to journalists Wednesday, Ghani noted that some of the Afghans who were abused while in detention and had their rights violated “were proven to be entirely innocent.”

Mohammad Sharif contributed to this report.