A Palestinian teenager admitted to Harvard said he was detained for hours at Boston’s airport and refused entry into the United States after officers disapproved of his friends’ political comments on social media.

Ismail Ajjawi, who lives in Lebanon, said that an officer also asked him about his religion during eight hours of questioning Friday at Logan international airport, according to an account he provided to the campus newspaper, the Harvard Crimson.

After five hours of searching his phone and laptop, Ajjawi said that an officer called him into a room and “started screaming at me”

“She said that she found people posting political points of view that oppose the US on my friend(s’) list,” he said in the statement to the Crimson.

The 17-year-old said that he protested that the comments came from friends and that he never posted his own political views but said his visa was nonetheless canceled and he was sent home.

The US Customs and Border Protection agency confirmed that it refused entry to Ajjawi but said it could not provide specific information due to reasons of privacy and law enforcement.

“This individual was deemed inadmissible to the United States based on information discovered during the CBP inspection,” said Michael McCarthy, a spokesman for the agency.

A state department official said he could not legally discuss details of the case but added: “Generally US 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.”

Ajjawi said he hoped to resolve his case in time to start classes next week at Harvard, one of the world’s most prestigious universities, the Harvard Crimson said.

Donald Trump has made a tough line on immigration a signature issue, with his administration deciding to monitor the social media use of all visitors as well as legal immigrants.

The move has prompted strong criticism from civil liberties advocates, who note that the US constitution’s first amendment guarantees freedom of speech.