Image copyright AMIDEAST Image caption Mr Ajjawi said he was denied entry after customs officers examined friends' social media posts

A Palestinian student who was controversially denied entry to the US last month when he arrived to begin study at Harvard has now been admitted.

Ismail Ajjawi said he was barred entry after border agents questioned him for hours at Boston Airport over social media posts written by friends.

The 17-year-old was admitted on Monday just in time to start at Harvard.

The US state department announced in June that most visa applicants were being asked for social media details.

The Customs and Border Protection (CBP) told the BBC on Tuesday that Mr Ajjawi had overcome "all grounds of inadmissibility and was admitted into the United States as a student on a F1 visa". The agency did not elaborate on why he had been denied entry and later admitted.

The CBP declined to comment on the specifics of the case last month when Mr Ajjawi's case was first reported, saying only that he had been denied entry "based on information discovered during the CBP inspection".

Image copyright Getty Images Image caption Mr Ajjawi returned to Harvard University just in time to start classes on 3 September

Mr Ajjawi's family said in a statement that they were relieved at the u-turn.

"The last ten days have been difficult and anxiety filled, but we are most grateful for the thousands of messages of support", they said.

They added that they hoped Mr Ajjawi's could now "simply focus on settling into College and his important class work".

Hamzah Raza, a fellow student at Harvard, tweeted a picture of Mr Ajjawi at the university.

Mr Ajjawi said his visa was cancelled after immigration officials searched his phone and laptop at Boston's airport on Friday 23 August. He said he was then denied entry despite protesting that he nothing to do with the social media posts cited by CBP.

In June, the US Department of State said it had begun requesting that most visa applicants submit social media names and five years' worth of email addresses and phone numbers.

Media playback is unsupported on your device Media caption President Trump proposed a new US immigration system in May

The administration of President Donald Trump first proposed the rules in March 2018. Officials at the time estimated that the new regulations would affect 14.7 million people annually.

Certain diplomatic and official visa applicants are exempt from the stringent new measures.