The facts aren't in dispute.

On Friday, a small group of assailants launched an attack near Jerusalem's Old City. Wielding guns and knives, they killed a female police officer and wounded three other people.

What happened next, though, is a source of controversy. Just hours later, the Islamic State claimed credit for the assault, saying its “soldiers of the caliphate” launched a “blessed operation … on a gathering of Jews.” The terrorist organization promised more of the same in Israel.

Minutes later, however, Hamas rejected that assertion. One of the attackers, the militant group said, was a member. The other two belonged to the Popular Front for the Liberation of Palestine. Both are Palestinian militant groups fighting what they call an Israeli occupation. "The three hero martyrs who executed the Jerusalem operation have no connection to Daesh [Islamic State], they are affiliated with the PFLP and Hamas," Hamas official Izzat El-Reshiq wrote on Twitter.

The Israeli military said their investigation showed the three attackers, killed at the scene, were residents of the West Bank. Two (both teenagers) came from a village near Ramallah, officials said.

The competing claims of responsibility highlight a major challenge in the era of global terrorism: When tragedy strikes, how do countries figure out who's really responsible?

Determining responsibility matters because militant groups use attacks like these to spur on followers and spark fear.

Claiming attacks is a key tactic of the Islamic State. Often, the terror group will say it's perpetrated assaults that aren't directed by the leadership or even centrally coordinated. “It creates the perception that ISIS is expanding, even though it's under attack on multiple fronts in both Iraq and Syria,” Kamran Bokhari, a fellow at George Washington University and senior lecturer at the University of Ottawa, told the Canadian Broadcasting Corporation. “That creates this sort of panic, and that works to the advantage of ISIS.”

“The PR's important,” added Scott Stewart, vice president of tactical analysis for Stratfor, a geopolitical intelligence firm based in the United States. "There are two battlefields: You have the physical battlefield and kind of the ideological or the media battlefield."

Stewart explained that the Islamic State will claim two kinds of attacks: the small number directed by the Islamic State's core in Iraq and Syria, and a much larger collection committed by “grass-roots jihadis” who act largely on their own, but proclaim their loyalty to the group.

That's not to say that the claims are all lies. Experts say that when the Islamic State claims credit for an attack, there is some tie back to the organization.

In Israel, the politics of an Islamic State claim are particularly fraught. As the Associated Press explains:

Israeli intelligence officers have said they believe that the group has been focusing their main efforts on attacking Arab states in the region, but cautioned that a successful attack on Israelis would add to the organization’s prestige in the Arab world.

That's part of the reason why countries do their own reporting after an attack. To suss out responsibility, investigators use many tools: They pore through social-media accounts. Trace the steps of the perpetrators, trying to figure out where their money came from and who they were in contact with. And they look at where the suspects traveled and whom they talked to on their cellphones.

In some cases, the attack itself offers important clues. Chunks of a bomb, for example, can reveal a bombmaker's signature. “You're ripping into the identity of the attackers,” Stewart told the CBC. “That's going to let you know basically … who they were working with and for.”