BAGHDAD — When an Iraqi court sentenced a prominent Sunni politician to death recently, it seemed like an unmitigated disaster for the country’s new prime minister, Haider al-Abadi.

Mr. Abadi, after all, had taken office with an international mandate to create a more inclusive government, and win the trust of Iraq’s disaffected Sunnis so they would fight Islamic State militants rather than support them. But the verdict, on capital murder charges brought by the previous government against the politician, Ahmed al-Alwani, prompted the defendant’s Alwani tribe to threaten that it would stop battling the Islamic State.

Mr. Abadi swung into action. He immediately contacted Sunni officials and Alwani tribe members, assuring them that there would be no execution. And he urged them to solve the matter by the tribal tradition of paying “blood money” to the families of the victims, two soldiers who were killed in a gun battle when commandos came to arrest Mr. Alwani last year.

His handling of the crisis in November was the most tangible sign yet that Mr. Abadi was successfully shifting the tone of politics here, and that courting Sunnis could help the government battle the Islamic State more effectively. Reassured by Mr. Abadi’s outreach, the Alwani tribe stayed in the fight on the government’s side.