Authorities in Bahrain on Tuesday freed Nabeel Rajab, the country’s best-known human rights activist, nearly four years after he was imprisoned on charges related to expressing anti-government dissent on Twitter, his family and his lawyer said.

Rajab, a co-founder of the Bahrain Center for Human Rights, will serve the remainder of his seven-year sentence at home, his lawyer, Mohammed al-Jishi, said in a text message. A photo of Rajab, smiling broadly while standing with his family, was circulated by his supporters on Tuesday.

Rajab’s prosecution became the most prominent example of Bahrain’s vigorous clampdown on dissenters in the years after the state forcefully quashed a pro-democracy uprising in 2011. His imprisonment, on charges widely dismissed as political, galvanized rights activists around the world and led to a chorus of calls for Rajab’s release, including from the United States, Bahrain’s close ally.

Bahrain, a small island state in the Persian Gulf that hosts the U.S. Navy’s Fifth Fleet, has recently released hundreds of prisoners over fears that the coronavirus would spread in jails. But the government kept prominent dissidents like Rajab behind bars.

His release was “absolutely unrelated” to the pandemic, Jishi said, adding that his client was eligible for release under a law allowing “alternative penalties” after convicted people served half of their sentences.

Rajab was convicted in 2018 on charges that he wrote social media posts criticizing wartime airstrikes in Yemen carried out by Saudi Arabia, Bahrain’s closest ally. He also accused prison authorities in Bahrain of abusing prisoners. The charges against him included insulting state institutions as well as a neighboring country.

In a jailhouse letter that was published in the New York Times a few months after he was detained in 2016, Rajab wrote that the experience of prison “is not new to me: I have been here before, from 2012 to 2014, in 2015, and now again, all because of my work as a human rights defender.”

Referring to his opposition to the war in Yemen, he wrote: “The civilian death toll was immediate and catastrophic, and I spoke out against the unfolding humanitarian crisis, calling for peace. Now, I am paying the price.”

Lynn Malouf, Amnesty International’s Middle East director, said in a statement that Rajab’s release was a “relief.”

“While this is a moment to celebrate, it is impossible to forget that he has spent almost four years unjustly separated from [his family], or to forget the many other peaceful activists who remain behind bars in Bahrain,” she added.

Sen. Chris Murphy (D-Conn.), writing on Twitter, said Rajab’s release was “good news and a sign of what can happen when the United States makes trouble over political prisoners.” Murphy’s post linked to an article about his visit last year to meet with Rajab’s family at their house in Bahrain.

“Great news,” said Maryam al-Khawaja, an exiled Bahraini human rights activist, also writing on Twitter. Her father, Abdulhadi al-Khawaja, another co-founder of the Bahrain Center for Human Rights, remains imprisoned in Bahrain. “Now time to release the rest,” she wrote.