CAIRO — Mohamed Soltan, an American citizen who spent nearly two years in an Egyptian prison on charges that he supported an Islamist protest, has been released by the Egyptian authorities and flew back to the United States on Saturday, his family said in a statement.

Mr. Soltan, 27, who had spent much of his detention on a hunger strike, was sentenced to life in prison in April. Human rights groups denounced the charges against him as political in nature, and the Obama administration, which had criticized the court’s verdict and voiced concern about Mr. Soltan’s failing health, had appealed for his release on humanitarian grounds.

After his sentencing, Mr. Soltan, a dual citizen, relinquished his Egyptian citizenship, apparently paving the way for his release under a legal decree that gives President Abdel-Fattah al-Sisi the ability to exile foreign citizens convicted of crimes.

“After extensive efforts, the U.S. government has successfully secured Mohamed’s deportation back home to the U.S., mercifully concluding this dark chapter for Mohamed and our family,” the statement said.