A Palestinian student who was allegedly questioned for hours by immigrations officials and refused entry to the country, has been able to take up his studies at Harvard University after the authorities reversed their decision.

Ismail Ajjawi, 17, who lives in Lebanon, had been due to begin undergraduate classes after studying at a school operated by a UN refugee agency and then winning a scholarship to attend the prestigious college, located in Massachusetts.

Last month, he was detained by officials at Boston’s Logan Airport, who reportedly questioned him for hours and refused him permission to enter the country.

Now, the organisation that has helped arrange his scholarship, said US officials in Beirut had reissued his visa after investigating his case. A friend tweeted a picture of the teenager on the Harvard campus.

“The last ten days have been difficult and anxiety filled, but we are most grateful for the thousands of messages of support and particularly the work of AMIDEAST,” his family said in a statement, referring to the academic organisation that provides funding for financially challenged Palestinian youths from Gaza, the West Bank, and Jerusalem.

Palestinians await Israeli demolition of their homes in the West Bank Show all 7 1 /7 Palestinians await Israeli demolition of their homes in the West Bank Palestinians await Israeli demolition of their homes in the West Bank Children play as their parents prepare for their homes to be destroyed (Bel Trew) Bel Trew/The Independent Palestinians await Israeli demolition of their homes in the West Bank A toddler plays in the dirt of Khan al-Ahmar village (Bel Trew) Bel Trew/The Independent Palestinians await Israeli demolition of their homes in the West Bank Palestinian flags festoon the Bedouin village of Khan al-Ahmar as they await eviction (Bel Trew) Bel Trew/The Independent Palestinians await Israeli demolition of their homes in the West Bank Children play as their parents brace themselves for the bulldozers (Bel Trew) Bel Trew/The Independent Palestinians await Israeli demolition of their homes in the West Bank Iman, 7, says she does not want to leave her home (Bel Trew) Bel Trew/The Independent Palestinians await Israeli demolition of their homes in the West Bank The demolition order includes the village’s school, which provides education for some 170 children from five different Bedouin communities. (Bel Trew) Bel Trew/The Independent Palestinians await Israeli demolition of their homes in the West Bank The playground of the school which will likely be demolished in the coming days (Bel Trew) Bel Trew/The Independent

It added: “We hope now that everyone can respect our and Ismail’s privacy and he can now simply focus on settling into college and his important class work.”

Ajjawi’s lawyer, Albert Mokhiber, called his client’s case a “classic sad tale with an exceptionally unique happy ending”.

Cracking the code: Young Palestinians take hold of their futures at Gaza's tech hub

“Against all odds a Palestinian refugee who attended UNRWA schools in the camps of Lebanon, earns a full scholarship to Harvard, hits a road block, but is eventually granted entry to the U.S. to pursue his college dream,” he said.

The 17-year-old was denied entry on August 13 after spending eight hours in Boston Logan International Airport. He told the student newspaper, the Harvard Crimson, the denial was the result of politically oriented social media posts by his friends.

“When I asked every time to have my phone back so I could tell them about the situation, the officer refused and told me to sit back in [my] position and not move at all,” he wrote in a statement. “After the 5 hours ended, she called me into a room , and she started screaming at me. She said that she found people posting political points of view that oppose the US on my friends list.”

Theodore Kattouf, the president and CEO of AMIDEAST, that is based in Washington DC and was established in 1951, said: “We are pleased that Ismail’s Harvard dream will come true after all. Ismail is a bright young man whose hard work, intelligence and drive enabled him to overcome the challenges that Palestinian refugee youth continue to face in order to earn a scholarship.”

In a statement, a spokesperson for the US customs and border agency (CBP), said Mr Ajjawi was “deemed inadmissible to the United States based on information discovered during the CBP inspection”.

The spokesperson added: “[I] can confirm that on Monday September 2, Ismail Ajjawi overcame all grounds of inadmissibility and was admitted into the United States as a student on a F1 visa.”