In the April 16 New York Times, Marwan Barghouti announced that he and 1,000 other Palestinian prisoners were launching a hunger strike. It’s easy to understand why.

West Bank Palestinians are colonial subjects. Even though the Palestinian Authority has some power, it is not a state, and the Israeli military can freely enter the West Bank and arrest anyone anytime it wants. The prisoners now refusing food were mostly tried in military courts where proving your innocence is nearly impossible. As the Israeli human rights group B’Tselem noted in 2015, “A Palestinian charged in a military court is as good as convicted.”

Israeli officials, and their American Jewish allies, responded to Barghouti’s op-ed with fury. The reason: Initially, The Times did not say why Barghouti sits in an Israeli prison. (It appended the information later). He was convicted in 2002 — in a civilian court not a military one — of murder. Thus, Deputy Minister for Diplomacy Michael Oren tweeted, Barghouti is not the Palestinian Nelson Mandela, as he’s sometimes described. He’s actually the “Palestinian Dylann Roof.”

Oren’s implication is clear: Because Barghouti was convicted of terrorism, his cause is illegitimate, even monstrous. The problem with this argument is that it doesn’t only explain why Marwan Barghouti isn’t Nelson Mandela. It explains why Nelson Mandela isn’t Nelson Mandela either.

Barghouti denies the specific charges on which he was convicted. (He did not defend himself on the grounds that the proceedings were illegitimate). But at the time of his trial, he did support violence. A decade earlier, when the Oslo Peace Process began, he had declared the era of military resistance over. “The armed struggle,” he claimed in 1994, “is no longer an option for us.”

But when Israel kept entrenching its control of the West Bank during the Oslo years, Barghouti changed his mind. “How would you feel if on every hill in territory that belongs to you a new settlement would spring up? he declared. “I reached a simple conclusion. You [Israel] don’t want to end the occupation and you don’t want to stop the settlements, so the only way to convince you is by force.”

Barghouti’s shift, which led him to play an active role in the second intifada, constituted a tragic mistake, even a crime, against both Palestinians and Israelis. I’m not justifying it. But he’s not the only national leader to have embraced armed struggle after losing faith in non-violence. Mandela did too.

For a half-century following its birth in 1912, the African National Congress practiced peaceful resistance to white rule. That resistance culminated in 1952 in a “defiance campaign” — partly inspired by Gandhi — consisting of mass protests, boycotts and strikes. When South Africa’s newly elected government responded with even harsher apartheid laws, however, Mandela demanded a different strategy.

As detailed in the book, “The Road to Democracy in South Africa”, Mandela began advocating armed resistance in 1953, and was reprimanded by ANC leaders. But when South African police murdered 69 protesters in the township of Sharpeville in 1960, and its government declared the ANC illegal, Mandela began pressing his case more aggressively. He met substantial internal resistance, especially from longtime ANC leader Albert Luthuli, who found it awkward that the ANC was considering violence when he had just won the Nobel Peace Prize. Still, Mandela, backed by other young militants, won the day.

One can imagine how Oren might describe Mandela’s actions today. Mandela did not merely support violence. In 1961 he became the head of the ANC’s new military wing, and began receiving funds from the Soviet Union. At the famed 1963 Rivonia trial, he was convicted of “recruiting persons for training in the preparation and use of explosives and in guerrilla warfare for the purpose of violent revolution and committing acts of sabotage,” as well as of supporting communism.

Was Mandela a terrorist? The U.S. government thought so. As late as the 1980s, it still classified the ANC as a terrorist group.

A critic might object that the circumstances under which Mandela and Barghouti turned to violence were different. Mandela argued for it in the early 1960s, after the South African government declared the ANC illegal. Barghouti advocated it in the early 2000s, after Israel had accepted the PLO as a legitimate negotiating partner.

The problem with this distinction is that Mandela kept supporting violence even when South Africa’s government grew more conciliatory. Six different times the authorities in Pretoria offered to release Mandela from prison if he accepted conditions including the renunciation of violence. Six times he refused. When President P.W. Botha asked him to renounce violence in 1985, Mandela shot back, “Let him renounce violence.”

A year later, the ANC detonated a bomb that killed three, and injured 69, at a bar in Durban. It did not suspend its armed struggle until after Mandela was released unconditionally from jail.

Israel isn’t the equivalent of apartheid South Africa. Inside the green line, where Palestinians enjoy Israeli citizenship and the right to vote, it certainly is not. Nor am I claiming that Barghouti is Mandela’s equal. After leaving prison, Mandela brilliantly stewarded South Africa toward reconciliation. Barghouti, by contrast, remains an enigma. He has long supported the two-state solution. But who knows what he would do as a free man?

My argument isn’t really about Barghouti at all. It’s that acts of violence, even horrific violence, don’t necessarily invalidate the cause of the people who commit them. America firebombed Dresden and dropped nuclear weapons on Hiroshima and Nagasaki; World War II was still a just war. In 1938, Irgun leader David Raziel detonated bombs in Haifa’s Arab Market, killing 21 people. His crimes didn’t invalidate the struggle for a Jewish state. (Oren’s government certainly doesn’t think so; Raziel’s face adorns an Israeli postage stamp).

Palestinians deserve to be citizens, not subjects. And against an Israeli government that rejects a Palestinian state near the 1967 lines, and every day entrenches its brutal and undemocratic control of the West Bank, Barghouti and his colleagues have the right to resist. I’m glad that they’ve chosen a hunger strike, which inflicts violence only upon themselves. I hope they never take up arms again. But to the extent that they still desire what Barghouti demanded the year he was convicted — “the end of the occupation” and “peaceful coexistence” between Palestinians and Jews — their cause is just.

“I was called a terrorist yesterday,” Mandela once said, “but when I came out of jail, many people embraced me, including my enemies, and that is what I normally tell other people who say those who are struggling for liberation in their country are terrorists.”

Do you hear that, Michael Oren? He’s talking to you.

Peter Beinart is a Forward senior columnist and contributing editor. Listen to his podcast, Fault Lines with Daniel Gordis here or on iTunes.