A Palestinian student denied entry to the United States last week is now on campus at Harvard University and started classes Tuesday, a Harvard official confirmed.

Ismail Ajjawi, a 17-year-old who lived in a refugee camp in Lebanon and earned a scholarship to Harvard, was allowed Monday to enter the United States, his attorney Albert Mokhiber said.

“I’m greatly relieved — and happy,” Ted Kattouf, president of the nonprofit education organization Amideast, said. “How can you not be happy that a young man who has done all the right things and has incredible intellectual ability is finally able to realize his dream? … It says a lot about America, that you can still have these kinds of stories.”

Ajjawi’s situation drew intense interest at a time when international students and scholars have been under increasing scrutiny, prompting debate over the appropriate balance between national security and academic freedom.

Last month, nine Arizona State University students from China were detained by U.S. Customs and Border Protection at Los Angeles International Airport and denied admission to the United States to continue their studies despite having appropriate documentation, school officials said. In letters expressing concern to the secretary of state and the acting secretary of homeland security, Arizona State president Michael M. Crow asked for an analysis of procedures that “have apparently been put in place to review the electronic devices carried by our students when they enter the U.S.”

Customs and Border Protection did not respond immediately to a request for comment Tuesday.

Ajjawi told the Harvard Crimson last week he was detained for hours and interrogated at Logan International Airport in Boston. After officials searched his phone and computer and asked questions about his religion and social media, his visa was revoked and he was sent back to Lebanon.

After five hours, an official screamed at him, Ajjawi wrote in a statement to the Crimson. “She said that she found people posting political points of view that oppose the U.S. on my friend[s] list. I responded that I have no business with such posts and that I didn’t like, [s]hare or comment on them and told her that I shouldn’t be held responsible for what others post.”

When asked about Ajjawi, Customs and Border Protection spokesman Michael McCarthy said last week that he could not give out information on individual travelers but that an individual had been deemed inadmissible to the United States based on information discovered during a customs inspection.

Ajjawi’s family was devastated, Kattouf said Tuesday. Ajjawi, who hopes to become a doctor, had turned down other scholarships to attend Harvard.

“You grow up in this kind of poverty, you show this kind of ability, this kind of character, this kind of ambition, you’re on the doorstep of realizing your dream, and you’re turned back,” Kattouf said. “It’s potentially soul-crushing.”

Kattouf praised the efforts of Harvard’s president, lawyers and members of the international student affairs office to help Ajjawi gain entry to the country.

Ajjawi’s family expressed appreciation for the efforts of people in Lebanon, Washington and Massachusetts who made it possible for their son to begin his studies. “The last ten days have been difficult and anxiety filled,” they said in a written statement, “but we are most grateful for the thousands of messages of support and particularly the work of AMIDEAST.” They expressed hope that Ajjawi will be able to focus on settling into school and classwork.

“It’s a classic sad tale with an exceptionally unique happy ending,” Mokhiber, Ajjawi’s attorney, said in a written statement.

A coalition of Harvard student groups, led by an immigrants’ rights group, launched a petition demanding Ajjawi be allowed to enter. Nearly 8,000 people signed it.

Sarah McLaughlin, director of targeted advocacy at the Foundation for Individual Rights in Education, said the organization is pleased Ajjawi can begin studies at Harvard, “but the attention his case helped bring to visa denials for scholars and students should not dissipate now that Ajjawi is in the United States.”

Other scholars and activists have been denied entry to the United States, hindering their ability to take part in academic events, McLaughlin said in an email. “As hopeful visitors continue to allege that they were denied entry to the United States because of their political speech — or, in the case of Ajjawi, other people’s speech — Americans must scrutinize how these decisions affect our national commitment to free expression,” McLaughlin said.

McLaughlin’s group expressed concern in June about a new State Department policy requiring visa applicants to provide social media identifiers to immigration officials, warning it could chill international scholars’ speech or allow immigration officials to deny entry to those whose political views they found objectionable.

Harvard president Lawrence S. Bacow recently expressed his concerns to Trump administration officials and members of Congress about increasing difficulties for international students and scholars to gain permission to study in the United States, and the lasting impact that could have on the country.

In a welcome letter to campus Tuesday, Bacow wrote, “Since May, the obstacles facing individuals ensnared in the nation’s visa and immigration process have only grown. Various international students and scholars eager to establish lives here on our campus find themselves the subject of scrutiny and suspicion in the name of national security, and they are reconsidering the value of joining our community in the face of disruptions and delays.”

He expressed his hope that as policymakers consider concerns about national security, they would recognize that universities are strengthened by people from around the world, “and the ways that U.S. national interests are served by a system of higher education whose strength rests on a willingness to transcend barriers, not erect them.”

Columbia University president Lee C. Bollinger wrote to campus Tuesday that “the FBI has been encouraging university faculty and administrators to develop protocols to monitor foreign-born students and visiting scholars, with a focus on those who are ethnically Chinese. To be sure, their concerns about unlawful technology transfers, especially in sensitive disciplines relating to national security, are to be taken very seriously. But universities cannot start monitoring their own people. That is not who we are.”