Mourners attend a funeral in August for people, mainly children, killed in a Saudi-led coalition airstrike on a bus in northern Yemen. (Naif Rahma/Reuters)

In a rare admission, a U.S.-backed, Saudi-led coalition accepted responsibility Saturday for an airstrike last month on a school bus in northern Yemen that killed scores of people, including at least 40 children.

The statement by the coalition called the attack unjustified and vowed to punish those involved.

The coalition said that an internal investigation had “concluded that there were mistakes made in abiding by the rules of engagement.” The coalition expressed “regret for these mistakes, and offers its condolences and solidarity with the families of the victims and wishes for a speedy recovery for the injured.”

The apology was striking in a conflict that has now entered its fourth year, with the Saudi-led coalition seeking to oust Houthi rebels and restore Yemen’s internationally recognized government.

More than 17,000 civilians have been killed or injured since the war began, mostly by airstrikes. The fighting has deepened the world’s worst humanitarian crisis, and millions are suffering from hunger, disease and displacement.

The apology followed mounting pressure by the United States and its allies for the coalition to fulfill promises to better protect civilian lives. Last week, the United Nations released a scathing report accusing all parties of possibly committing war crimes in Yemen. It particularly cited coalition airstrikes. The coalition rejected the report’s findings.

Hours after the report’s release, Defense Secretary Jim Mattis publicly declared that continued military support to U.S. allies in the conflict “is not unconditional” and hinges on improved efforts to avoid civilian casualties.

The Pentagon has been assisting the coalition with refueling warplanes, intelligence sharing and billions of dollars in weapon sales.

The apology also comes ahead of U.N.-sponsored negotiations in Geneva next week involving all the parties in Yemen, marking the first effort to bring an end to the conflict in more than two years.

The coalition had initially claimed that the Aug. 9 airstrike in Saada province was “a legitimate military action” against Houthi rebels who fired a ballistic missile into a border city in southwestern Saudi Arabia a day earlier. The missile attack killed one civilian and wounded 11, the coalition said. It also claimed the rebels were using children as human shields.

Speaking to reporters in the Saudi capital, Riyadh, Lt. Gen. Mansour al-Mansour, a legal adviser for the coalition’s internal investigations body, said intelligence had indicated that the bus was carrying rebel leaders, which would have made it a legitimate target.

But delays in executing the attack led to the civilian casualties, he said, describing them as “collateral damage.” Witnesses on the ground said the bus was carrying children returning from a summer school trip.

The coalition said it would begin the legal process to “hold those who committed mistakes” accountable and also is making plans to compensate the Yemeni victims. It further pledged to do a better job in preventing civilian deaths.

“The coalition will continue to review the rules of engagement, and seek to improve it in ways that can ensure those mistakes are not repeated in accordance with lessons learned from previous operations,” the statement read.

Kareem Fahim in Istanbul contributed to this report.