BAGHDAD — The spymaster arrived unannounced, bodyguards in tow on a cold winter night. Heads turned slowly, murmurs rippled through the mourners, and most surprised of all was Ali al-Mokhtar, the grieving father.

Ali walked slowly across the funeral hall, voice hoarse and shoulders sagging, to greet him, relatives later recalled. The unexpected guest looked Ali in the eyes.

Ali clutched the death certificate for his middle child, Mohammed. “We need it written down,” he said, pointing to the line for cause of death, which had been left blank. “You need to tell everyone what happened.”

What no one could know that night was that the spymaster, Mustafa al-Kadhimi, would soon, and unexpectedly, become the country’s prime minister. How he would respond to requests like Ali’s would reveal Kadhimi to be a leader intent on setting Iraq on a new course but confronted by powerful, often violent forces determined to thwart him.

Twenty-year-old Mohammed was one of more than 500 Iraqis gunned down during anti-government protests over the past year by official security forces and militia groups.

As head of Iraq’s intelligence agency, Kadhimi had privately backed the protesters’ demands for a new government free of corruption, sectarian influences and foreign domination. But as the country’s new leader, his efforts to deliver accountability for their deaths and advance elements of their revolutionary agenda would collide with interests that have formed the backbone of Iraq’s political system since the ouster of Saddam Hussein.

Close associates of Kadhimi would later say that his appearance at the funeral on that February evening had been no coincidence because he had been sympathetic to the protesters’ grievances.

In response to Ali’s appeal, Kadhimi had pressed his hand against the breast of his sharp, dark suit and promised that the killers would face justice, according to relatives attending the ceremony. “Mohammed’s blood won’t go in vain,” Kadhimi told him.

Echoing his promise to Ali, Kadhimi has vowed since he emerged from shadows in May to become prime minister — as a reformer but also a man of the system — to investigate how so many of the country’s youths were killed in the streets.

Many Iraqis question whether he would dare to name those who gave the orders. Would he succeed in disciplining the country’s militias, many backed by Iran? Once his intentions became clear, one of those armed groups struck at his inner circle this summer by killing a prominent researcher who was a close confidant. It was a clear warning to the prime minister.

For Mohammed’s family and hundreds more like them, the idea of justice is bigger now than just filling in a death certificate. It is, they say, about the vision of Iraq their sons and daughters had died for.

As Kadhimi’s bodyguards shepherded him toward the exit, Ali called out to him one last time, relatives recounted.

“Please.” This time he was begging.

Kadhimi said Ali had his word.

And then he was gone.

Different faiths, one cause: ‘To save my country’

Mohammed had, for the first time, been excited by a dream. So, too, were two other young men who would die alongside him on that gray February day. None of them knew the others. They had come from different religious backgrounds. But their individual stories had been woven from a common history.

Mohammed had been 3 when the Americans invaded Iraq, forcing Saddam Hussein from power in 2003 and replacing his dictatorship with a new political system that entrenched religious and ethnic power brokers, who often operated like rival Mafiosi. By the time Mohammed was 6, there was a nightmarish war underway between Sunni and Shiite Muslims, and car bombs echoed through the city. He was 7 when gunmen burst into his school to execute the principal meters from where Mohammed sat, his relatives recalled.

The son of a wealthy Shiite family, Mohammed planned to graduate from college as a computer engineer, but his career path was blocked. Securing a government job would require a hefty bribe, and the private sector was anemic.

Growing up on the other side of town, Alaa al-Shimmari was the son of a Shiite family that had long struggled to make ends meet. He had been born on the edge of Sadr City, the sprawling Shiite working-class district home to hundreds of thousands of families who’d left southern Iraq for the promise of a better life in the capital. Instead, the roads had crumbled after decades of neglect, and government-provided electricity was a distant dream. American soldiers fought fierce urban battles in Sadr City, and during the war between Sunnis and Shiites, explosions left body parts on the streets.

Alaa had quit school as a teenager to support his family, relatives recounted. Now 26, he was suffering under the weight of a loan he’d taken to pay a bribe to secure his government job. The government had failed to pass a new budget and, for Alaa, that meant no salary.

And then there was Ramon Rayan, 16 and shyly feeling his way through adolescence. His life had been shaped by his faith. Iraq’s Christians once numbered as many as 1.4 million, but two-thirds were thought to have fled the country.

Born in the northern city of Mosul, Ramon’s family was displaced several times by fighting. In 2009, his father, Rayan, was kidnapped by al-Qaeda and released only after the family had sold off what they could to raise a ransom. Then in 2014, the Islamic State arrived. Christians fled in terror. Militants robbed them at checkpoints on the way out. By the time the family reached Baghdad, relatives said, they had little left. Their cramped apartment was paid for with Rayan’s salary and whatever the teenager could make through odd jobs.

Ramon didn’t tell his parents where he was going on that February morning he left home for the last time. But he spoke to the local shopkeeper, his parents later learned.

“Where are you off to?” the man recalled yelling over to Ramon, and the skinny teenager smiled.

“To save my country,” he said.

Two sides, eye to eye

As Ramon made his way toward central Baghdad on Feb. 25, Mohammed was in his apartment near the airport also getting ready to join the action, according to family accounts. Mohammed’s father, Ali, had once asked him what could possibly be worth the risk. Hundreds had already died in the protests. “It’s not just for me. It’s for all of us,” Ali recalled his son answering. “We need a homeland.”

Across town, Alaa was edging through the city traffic toward his job at the electricity ministry.

In central Tahrir Square, the day was just getting going. Young Iraqis who had been camped out in protest tents woke hazily, lighting cigarettes and checking their phones for news.

Mohammed and Ramon approached the concrete wall that separated riot police and the protesters. As rain swirled down in bursts, the two sides were eye to eye.

The tear gas began just past midday.

Heavy smoke grenades bounced high and fast along the asphalt.

Protesters threw protective arms around friends as they fled. Others lobbed the burning-hot gas bombs back across the wall, while some just stood there, hands aloft and bodies high on adrenaline as they stared down the riot police, according to videos of the event and interviews with protesters.

Somewhere in the middle, a young saxophonist was playing, but the music trailed off as the gas reached his throat.

Mohammed’s sister, Zainab, recalled that she could barely hear him when she called to ask where he was.

Then, a mass of riot police sprinting toward the wall. A young tuk-tuk driver, who’d driven his motorcycle rickshaw into the middle of the protest, filmed them as they took their positions, cocked their rifles and started to shoot.

When Zainab called Mohammed again, someone else picked up and then hung up quickly. She called a second time, then a third.

Her brother was out cold. Blood was pouring from the hole where a tear-gas canister smashed his face. Nearby was Ramon, his thin body riddled with the shrapnel.

When news of the violence reached Alaa, he raced to the scene himself, his best friend later said.

Alaa was shot within minutes. He died quickly.

Cause of death: ‘Pending’

Ali found his badly wounded son at Baghdad’s neurological hospital. Mohammed’s skull was smashed and he was bleeding internally.

Iraqi security forces had been firing tear gas and smoke grenades that were up to 10 times heavier than those typically used for crowd control, according to Amnesty International. Many were shot directly at protesters’ heads.

“If we told you he was going to be okay, we’d be lying to you,” Ali remembers a senior doctor telling him.

Mohammed died the night of Feb. 25. On the death certificate, under reason for death, pathologists at Baghdad’s morgue wrote “pending.”

Mohammed’s family said they repeatedly contacted the morgue to follow up, but the calls went unanswered. “No one in this country would dare commit words to paper that suggest our policemen are criminals,” Ali said.

Medical officials say in interviews they were working 24-hour shifts during the height of the violence and that the backlog of investigations won’t be cleared for months.

A week after the killings, across town in the Karrada neighborhood, Ramon’s family heard a knock on the door. Outside, there was a police officer waiting, Rayan said. The visitor told them that he had witnessed Ramon’s death and that the teen had been killed by another member of the riot police.

The family’s grief exploded. They believed their guest — he would later provide a signed statement identifying the alleged killer — but felt powerless. The family had no chance at holding the perpetrator accountable, they thought. Only the prime minister could.

As the head of intelligence, Kadhimi had boycotted sessions of Iraq’s national security council when the violence against protesters had peaked late last year, his close associates recalled. “He would have resigned back then, but he was pressured not to,” said one political ally. “There’s no question about what he thought back then. He thought the killing of protesters was wrong.”

When the death toll had reached 350, the prime minister at the time, Adel Abdul-Mahdi, had stepped down. Iraq’s political parties, which include several representing the country’s paramilitary groups, struggled for months to settle on a successor.

In May, after two other candidates had failed to win enough support, the parties selected Kad­himi.

Girding for battle

Almost 10 months to the day since protests began, Kadhimi’s spokesman, Hisham Dawoud, told reporters that the first stage of the investigation was complete. He reported that 561 people had been killed, most of them young and most of them around Tahrir Square.

The government designated the victims as “martyrs,” entitling each one’s family to receive about $8,400 to cover funeral and burial expenses with perhaps a little left over. Dawoud said the investigation could result in prosecution of the killers.

Skeptical journalists asked Dawoud whether officials would dare investigate the Iran-backed militias blamed for some of the greatest abuses.

“We don’t want committee after committee,” Dawoud responded gravely. “There’s a famous saying in Iraq: If you want to bury a case, create a committee.”

The same groups accused of firing on demonstrators are now girding for battle with Kadhimi. As he installs his allies atop Iraq’s security forces and clamps down on militia revenue, Iran-linked groups are accused almost daily of challenging the prime minister by launching rocket attacks at sites used by the U.S. military.

The assassination of the well-known government confidant, Hisham al-Hashimi, in July drove home the message that few in Iraq are untouchable. Although an investigation into his killing was launched, no results were made public.

Kadhimi’s political associates have disappeared from the airwaves. In private, some wonder who among them might be next. “He wants justice, but his hands are tied,” one of Kadhimi’s advisers said flatly. “He didn’t know the backlash would be this tough.”

In photographs, the prime minister looks tired.

Meanwhile, the killing of protesters has begun again, this time in the southern city of Basra. As in Baghdad, the dead had been advocates for a better Iraq. Activists blame militias backed by Iran.

“Without prosecutions, then you may as well erect a billboard in Tahrir Square saying that the lives of our young Iraqis mean nothing,” said one young protester, speaking on the condition of anonymity out of fear for his safety.

For many family members of the Baghdad victims, the investigations conducted so far feel too little and late.

Ramon’s father is urging them not to give up on Kadhimi. “He’s trying,” Rayan said. It’s too early to despair of justice or even a new dawn for Iraq, he’s been telling them.

On visits to Tahrir Square, where protesters still gather, Rayan has been trying to convince them that the prime minister needs time to achieve substantive progress.

“If he acts quickly, there’ll be no results,” he said. “I keep telling them that.”

Correction: The story incorrectly referred to Mohammed al-Mokhtar’s family as being from Islam’s Sunni sect, when they are in fact Shiite. The story has been corrected.