The story of an incoming Harvard freshman who was denied entry into the United States after his laptop and cellphone were searched at the airport last week has immigration and free speech advocates sounding the alarm over the Trump administration’s increasingly restrictive immigration policies and how they are enforced.

According to the Harvard Crimson, which first reported the story on Tuesday, Ismail Ajjawi, a 17-year-old Palestinian resident of Lebanon on his way to Harvard to begin classes as a freshman, had his student visa canceled and was returned to Lebanon several hours after arriving at Boston’s Logan International Airport last Friday — according to the student, after border agents searched his cellphone and investigated his social media contacts.

One of the buildings on the Harvard University campus. (Photo: Getty Images)

The incident demonstrates “an astounding disregard for the principle of free speech,” according to Summer Lopez of PEN, an advocacy group for authors.

Ajjawi told the Crimson in a written statement that he and other international students were questioned by immigration officials upon arrival in Boston, but that one officer continued to press him on his religious practices after the rest of the students were allowed to leave the airport. According to the Crimson, Ajjawi says the same officer asked him to unlock his cellphone and laptop and, about five hours later, returned with questions about the social media activity of his friends.

“She said that she found people posting political points of view that oppose the U.S. on my friend[s] list,” Ajjawi wrote to the Crimson. Ajjawi told the student paper that he assured the officer that his friends’ posts did not reflect his views, writing “I have no single post on my timeline discussing politics.”

But Ajjawi never made it out of the airport. Spokespeople for Harvard and U.S. Customs and Border Protection confirmed that he was, in fact, denied entry to the U.S. (Ajjawi could not be reached for comment.) Critics of the Trump administration’s immigration policies say that Ajjawi’s account, if accurate, offers new evidence of the threat to civil liberties of the increasingly common practice of searching travelers’ electronic devices and using social media to vet visa applicants.

Photo: Brian Snyder/Reuters

“The dangers of giving border officers near boundless discretion to make decisions based on surveillance of social media or digital device searches are obvious,” said Hugh Handeyside, senior staff attorney at the American Civil Liberties Union. “Those decisions are often misinformed, arbitrary or infected with racial or religious bias.”

Handeyside is one of the attorneys involved in an ongoing lawsuit by the ACLU and the Electronic Frontier Foundation, a nonprofit that advocates for digital privacy, on behalf of 10 U.S. citizens and one legal permanent resident who were subjected to warrantless searches of their smartphones and laptops upon returning to the U.S. after traveling abroad. The lawsuit, filed in 2017 against the Department of Homeland Security, challenges the growing frequency of warrantless searches on travelers’ electronic devices at ports of entry.

Though CBP policy has long granted officers broad authority to search property, including electronic devices of those arriving in the United States, the agency’s own data shows a significant increase in the use of that authority in recent years.

Of the more than 383.2 million arriving international travelers processed by CBP in fiscal year 2015, just 8,503 had their electronic devices searched. That number more than doubled to more than 18,400 in fiscal year 2016 and has continued to climb, with nearly 30,000 travelers subjected to electronic device searches upon arrival in the United States during fiscal year 2017.

Though the suit by the ACLU and EFF suit is on behalf of citizens and green card holders, who have the legal right to enter and live in the U.S. indefinitely, other recent cases seem to illustrate how information found during these searches can be used to keep out visa holders like Ajjawi.

One such case is that of Abdikadir Mohamed, who wound up spending nearly a year and a half in immigration detention following an apparently botched electronic device search in December of 2017.

Mohamed, a native of Somalia, was living in South Africa as an asylum seeker when he received an immigration visa from the U.S. Embassy in Johannesburg in late November 2017 — just days before the Supreme Court agreed to allow the final version of President Trump’s ban on travelers from certain countries, including Somalia, to take effect.

A woman and her daughter wait for a flight from Qatar soon after President Trump's travel ban at Logan Airport in Boston, Jan. 30, 2017. (Photo: Brian Snyder/Reuters)

Because he’d already received his visa, Mohamed was not subject to the ban and on Dec. 13, 2017, he was en route to Columbus, Ohio, where his then-pregnant wife and daughter, both U.S. citizens, were living. However, his journey to join his family was derailed during a stop at New York’s John F. Kennedy airport. After successfully making it through customs with his visa stamped, Mohamed was headed for his connection to Columbus when he was stopped by two CBP officers who asked him if he was from Mogadishu. When he replied that he was originally from Somalia, one of the agents instructed him to unlock his phone and hand it over.

Instead of boarding his flight to Ohio, Mohamed spent the next several hours being searched and interrogated, his requests for an interpreter denied. According to an in-depth report by the Intercept on Mohamed’s case, the CBP officers found a press release on his cellphone from an Ethiopian separatist group called the Ogaden National Liberation Front, and questioned him about his ties to the organization. Mohamed has maintained that he has no affiliation with the group and says he stated as much during his interrogation. But he was accused of admitting to being a member of the Ogaden National Liberation Front and of failing to disclose that fact during the visa application process.

Ultimately, Mohamed was told he could either go back to South Africa or try to contest his removal in immigration court by seeking asylum in the U.S. He chose to fight his expulsion and was taken to an ICE detention center in Elizabeth, N.J. He remained in custody until last month, when an immigration judge determined that his asylum case was strong and ordered him released. During his time in detention, he suffered from untreated tuberculosis that landed him in the hospital for 10 days, and missed the birth of his second child.

In court records, it was revealed that Mohamed had been targeted by the Tactical Terrorism Response Team (TTRT), a little known branch of CBP that imposes additional inspection on certain travelers who’ve already been approved for entry by U.S. immigration officials. Department of Homeland Security officials have boasted about the program’s reach more than once to members of Congress. Written testimony from May 3, 2017 states that “For FY 2017 to date, as a result of the dedicated efforts of the men and women serving on CBP’s TTRT, and the information discovered during secondary inspection, nearly 600 people who had been granted visas or other travel documents … have been refused admission to the United States.” According to another written testimony delivered by DHS officials four months later, by Sept. 7, 2017, more than 1,400 people had been denied entry to the U.S. because of TTRT efforts and additional information discovered during secondary inspections upon arrival at ports of entry.

Photo: Matt Campbell/EPA-EFE/Shutterstock

It’s not clear whether Ismail Ajjawi was targeted by TTRT. (A CBP spokesman was not able to provide an answer to that question before publishing time.) But Tarek Ismail, an associate law professor at the City University of New York (CUNY), said he sees a lot of parallels between Abdikadir Mohamed’s experience and what Ajjawi says happened to him.

“CBP is telling us that they’re using information that they get from secondary inspections and here is an example was something they got from someone's cell to deny them entry,” said Ismail, who took on Mohamed’s case as part of CUNY’s Creating Law Enforcement Accountability and Responsibility, or CLEAR, project.

Ismail also noted a recent tweet by Abed Ayoub, the legal and policy director of the American-Arab Anti-Discrimination Committee (ADC), in which he posted a screenshot of an official DHS deportation form showing how a client was questioned about content found in their WhatsApp account during a search of their cellphone, and ultimately denied entry.

New normal — At least twice a month I have clients denied entry because of something in their WhatsApp. Most of the time its pictures or videos forwarded to them in a WhatsApp Group. Many tools being used to stop immigrants from legally entering. pic.twitter.com/ewIUswSCsy — Abed A. Ayoub (@aayoub) August 22, 2019

“At least twice a month I have clients denied entry because of something in their WhatsApp,” Ayoub wrote. “Most of the time its pictures or videos forwarded to them in a WhatsApp Group. Many tools being used to stop immigrants from legally entering.”

Ismail described the increasingly common practice as a “Thought Police sort of exercise, where if we don't like the things you say or believe, or [the things] the people you associate with say or believe, we're going to exclude you from entry.”

The Trump administration has also taken additional steps to vet the social media activity of potential immigrants and visitors to the U.S. before they even arrive in the country. Under a State Department policy that went into effect this spring, nearly all visa applicants must now submit their social media usernames as well as old phone numbers and email addresses — information that had previously only been requested from people who’d visited terrorist-controlled regions and others flagged for additional scrutiny.

“This case demonstrates all too well the damage these ill-conceived policies can do,” Summer Lopez, senior director of free expression programs at PEN America, said in a statement to press.

“Preventing people from entering the country because their friends critiqued the U.S. on social media shows an astounding disregard for the principle of free speech,” Lopez’s statement continued. “The idea that Ajjawi should be prevented from taking his place at Harvard because of his own political speech would be alarming; that he should be denied this opportunity based on the speech of others is downright lawless.”

In an emailed statement to Yahoo News, a State Department spokesperson declined to discuss specific details relating to Ajjawi’s case, as “visa records are confidential under U.S. law,” and referred additional questions about travelers denied entry to the Department of Homeland Security.

“Generally, the visa applicants are continuously screened, both at the time of their application and afterwards, to ensure they remain eligible to travel to the United States,” read the statement.

However, a State Department official reportedly told the AFP that “generally U.S. law does not authorize the refusal of visas based solely on political statements or views if those statements or views would be lawful in the United States."

While visas are issued and revoked by the State Department, U.S. Customs and Border Protection has the authority to cancel someone’s visa if they are deemed “inadmissible” upon arrival.

“CBP is responsible for ensuring the safety and admissibility of the goods and people entering the United States,” CBP spokesman Michael McCarthy said in a statement. “Applicants must demonstrate they are admissible into the U.S. by overcoming all grounds of inadmissibility including health-related grounds, criminality, security reasons, public charge, labor certification, illegal entrants and immigration violations, documentation requirements, and miscellaneous grounds.”

Ajjawi “was deemed inadmissible to the United States based on information discovered during the CBP inspection,” McCarthy continued. He declined to provide any further information on the student’s specific case, including on what grounds Ajjawi was deemed inadmissible and what information was discovered that led to that decision.

Though he has been returned to Lebanon, Ajjawi was not deported, meaning that he can technically reapply for a visa with the State Department. Harvard is hoping to have him back in Boston before the fall semester starts, on Sept. 3.

“The University is working closely with the student’s family and appropriate authorities to resolve this matter so that he can join his classmates in the coming days,” Harvard spokesperson Jason Newton said in a statement to Yahoo News.

Download the Yahoo News app to customize your experience.

Read more from Yahoo News: