He was detained when coming back to the U.S. from a cruise that went to Mexico and Haiti.

For many, it's risky to leave the United States.

Maysam Sodagari, an Iranian chemical engineer, was coming back to the U.S. via Florida from a gay cruise that goes to Mexico and Haiti when he was detained and barred from re-entering the country.

Sodagari, who is a green card holder, was released Sunday after being detained for more than four hours. "I am free to go back home," he wrote. He provided continual public updates along with Facebook Live videos in case he eventually lost access to his phone. Sodagari was on Atlantis, a sold-out seven-day gay cruise that was celebrating it's 25th anniversary, reported the Miami Herald.

President Trump signed an executive order into law Friday that barred around 218 million people from seven countries from entering the country for 90 days, reported CNN. Though the White House claimed it was not a "Muslim Ban," former New York Mayor Rudy Giuliani went on Fox News and said that Trump asked him to assist him in crafting a "Muslim Ban" in a "legal" way. The ban bars people from Iraq, Syria, Iran, Libya, Somalia, Sudan and Yemen from entering the country, even if they have visas or green cards. A federal judge ruled on late Saturday that those who have valid visas couldn't be deported after the American Civil Liberties Union filed a lawsuit challenging the order. But the order did not specify whether those detained should be allowed entry into the country. The Department of Homeland Security said it's still enforcing the order and won't allow people from these countries to board transportation to the United States. In other words, those in Sodagari's situation would be risking access to the country even now if they took a vacation.

Protests have erupted all over the country Saturday in major airports in New York, Chicago, Seattle, Los Angeles. More protests will take place Sunday. At Dulles airport outside of Washington, D.C., New Jersey Sen. Cory Booker showed up to assist detainees. Sen. Elizabeth Warren showed up at Logan International Airport to assist detainees as well. Rep. John Lewis was at the Atlanta airport helping detainees to get released. Politicians showed up at many protests, along with lawyers who were working pro-bono to assist those detained by Homeland Security. Photos on social media showed lawyers working with their laptops sitting on the floor of airports preparing documents.

Volunteer lawyers here on the ground in terminal 1 drafting habeas petitions to free detained Iranians and Yemenis. pic.twitter.com/Zyt9csPB2J — Danny Gold (@DGisSERIOUS) January 28, 2017

Before leaving the port in Cuba, Sodagari wrote that he wasn't sure what the outcome would be if he was deported to Iran, where many LGBT people are persecuted because of their sexual orientation. He said he appreciated getting to live his life out as a gay man in America.

Prior to being detained, Sodagari gave updates about his whereabouts. "Just got stopped on the ship exit, as others were allowed to leave....," he wrote after attempting to get out of the ship. His next update was: "I m being escorted to the cbp." Then he wrote: "Maybe this is part of a random check, I am not sure if it is related to my immigration case." His next two updates were videos and a post that said: "I have been asked to go to a room, and wait. He said it may take a while."

After this he must have grown aware of the protests taking place and the outpouring he was getting via Facebook, so he wrote to supporters: "I feel the support of everyone here, from the officers, sheriff and other passengers. Thank you all. Still waiting in the room." He wrote that he was released one hour later.

A friend of Sodagari posted a photo of him after his release:

Many came to Sodagari's aid on social media.

Yet another horrifying story. This gay man, who has a green card, might be sent back to Iran to face death. https://t.co/z1AXZJlXf0 — Tommy Krasker (@TommyKrasker) January 29, 2017

Omg. I'm going to cry. I am praying that he will not be deported. He will die. #STOPTHEINSANITY https://t.co/TqgN49sPdB — Brandon (@ohhibrandon) January 29, 2017

Update on May Sam: he has the ACLU by his side and is in good hands! @ACLU pic.twitter.com/J8t3Ert6IP — Brandon (@ohhibrandon) January 29, 2017

LGBT groups condemned the ban Saturday. “President Trump’s attacks on immigrants and refugees are a direct assault on America’s most fundamental values,” said Chad Griffin, president of the Human Rights Campaign. “Donald Trump’s unjust and unconscionable executive orders make life more dangerous for countless LGBTQ people, and could equal a death sentence for those trying to escape violence and persecution from places such as Syria. No wall, no matter how high, can block America’s promise of liberty and justice for all.”