BAGHDAD — A group of Iraqi Sunni refugees had found shelter in an abandoned school, two families to a room, after fleeing fighters from the Islamic State in Iraq and Syria. They were gathered in the school’s courtyard last week when the Iraqi Air Force bombed them.

The bombing, in Alam District near Tikrit, may well have been a mistake. But some of the survivors believe adamantly that the pilot had to know he was bombing civilians, landing the airstrike “in the middle of all the people,” said Nimr Ghalib, whose wife, three children, sister and nephew were among at least 38 people killed, according to witnesses interviewed last week, as well as human rights workers who detailed the attack on Wednesday.

The attack fit a pattern of often indiscriminate shelling and airstrikes on Sunni areas by the armed forces of the Shiite-led Iraqi government. The strikes have added to a long and bitter list of Sunni grievances, leading many to view the government’s leaders as an enemy — and some to regard the government as an even greater threat than the Sunni extremists in ISIS.

Overcoming that mistrust is a fundamental challenge facing the new Iraqi government, led by Prime Minister Haider al-Abadi, as it tries to win Sunni Iraqis over to its side in a fight against the Sunni extremists. And it is a prerequisite of President Obama’s new plan to fight the militant group.