(Monica Akhtar/The Washington Post)

Colleges and universities are grappling with the implications of President Trump’s executive order barring people from seven mostly-Muslim-majority countries from entering the United States.

The order, which affects citizens of Iraq, Iran, Syria, Yemen, Sudan, Libya and Somalia, has left international students and faculty fearing expulsion, stranded outside of the country, detained or uncertain of whether to travel. University leaders have pledged support to those whose lives are being upended by the new rules, but they, too, are unsure of the full ramifications of the order.

Federal courts in several cities have blocked enforcement of the ban, while the Trump administration says green-card holders will no longer be affected. Still, the Department of Homeland Security said Sunday that it would continue to implement the order despite the judicial rulings, creating more confusion and frustration.

Schools across the country scrambled Sunday to account for international students, faculty and staff with social-media posts signaling problems and attorneys in some cases having trouble getting to talk with people being detained. There was confusion about whether just student visas were at risk, or whether green-card holders and dual citizens might be detained, as well.

Demonstrators gather outside of the international arrivals terminal at Philadelphia International Airport on Sunday. The nation’s colleges and universities are concerned about how the ban will affect their students and faculty. (Tracie Van Auken/European Pressphoto Agency)

The effect on university personnel was felt almost immediately after the executive order went into effect. Two Iranian nationals who are associate professors at the University of Massachusetts at Dartmouth were detained Saturday upon arrival at Boston’s Logan International Airport. Arghavan Louhghalam and Mazdak Pourabdollah Tootkaboni, both of whom are green-card holders, were held for several hours before being let go, said Susan Church, a lawyer who helped get them released.

“They were overwhelmed by emotion when they reunited with their families and when they heard all of the people cheering and holding signs of support,” said Church, who heads the New England chapter of the American Immigration Lawyers Association.

Church, who said she had had about two hours of sleep Saturday night, joined a throng of immigration and civil rights lawyers at the airport to offer legal counsel to targeted immigrants. Early Sunday morning, two federal judges in Boston issued a seven-day halt to Trump’s order. The reprieve is temporary, but for Church, who called the president’s order “patently unconstitutional,” it was an important first win.

“This is what makes America great,” Church said. “Two federal judges came in late on a Saturday night to hear this case. They were responsive to a dire situation.”

Johns Hopkins University, the University of Virginia and George Washington University are among several schools telling students and scholars affected by the ban to refrain from traveling outside the United States because of worries they may not be allowed to re-enter.

“It’s very, very disruptive to students who are in the middle of training; it’s very disruptive to master’s and postdoc students who are involved in experiments, who are doing research. It’s not just them who are affected, it’s their research project that is affected,” said Lizbet Boroughs, associate vice president for federal relations for the Association of American Universities. “There’s the humanitarian concern, the moral concern — which is ­paramount.”

Boroughs said the order could ultimately hurt the country’s competitiveness if the best and brightest research scholars no longer want to study or work in the ­United States, a sentiment echoed throughout higher education.

Wallace D. Loh, president of the University of Maryland, said that the school is assessing how the order maymight affect students and faculty, but he said that “the potential for negatively impacting the educational and research missions of our campus is significant.” Loh and other college leaders have affirmed the value of having international students and educators, hoping to combat the perception of the United States as hostile to foreign intellectuals.

“Our ability to attract the best students and faculty from around the globe enhances our teaching, learning, research and societal impact and is in part responsible for our standing as a great public research university,” University of Michigan President Mark S. Schlissel said in a statement. Schlissel said the university would comply with federal requirements related to its international programs, but stated that “the university does not share sensitive information like immigration status.”

New York University President Andrew Hamilton assured students that the school would not permit federal officials on campus to gather information about immigrants without a subpoena. He said the university is arranging information sessions with the law school for students and faculty affected by the travel ban.

Trump and others have raised concerns that refugees and students are not vetted thoroughly enoughbefore being allowed to enter the United States. After Abdul Razak Ali Artan used his car and a knife to attack people at Ohio State University last month, Trump said the Somali student should not have been ­allowed into the country .

Sen. Charles E. Grassley ­(R-Iowa), the chairman of the Senate Judiciary Committee, wrote in a letter to then-Homeland Security Secretary Jeh Johnson that the family’s application to be admitted as refugees should have been more thoroughly vetted to eliminate the possibility of ties to a terrorist group. Federal law enforcement authorities have said that Artan, who was Muslim, was apparently radicalized online, inspired by the Islamic State and radical cleric Anwar al-Awlaki, but with no apparent actualcontact with terrorists overseas.

“If the idea is to strengthen the protection of Americans against terrorism, there are many far better ways to achieve it,” Purdue University President Mitch Daniels said in a statement. About 100 students and 10 members of the Purdue faculty are from affected countries. Daniels, the former Republican governor of Indiana, called the order “a bad idea, poorly implemented” and onethat he hopes Trump “will promptly revoke and rethink it.”

Narges Bayani, a PhD candidate at NYU’s Institute for the Study of the Ancient World, was among those detained at John F. Kennedy International Airport when she returned from Iran over the weekend. Faculty from the university’s law school, alongside Democratic Sens. Charles E. Schumer and Kirsten Gillibrand, intervened to have Bayani released Sunday afternoon.

At MIT, school leaders wrote that they were “extremely concerned about the situation” and notedthat more than 40 percent of faculty and graduate students and 10 percent of undergraduates are internationally born. The executive order “is already having an impact on members of our community,” Provost Martin A. Schmidt wrote in a letter to the school community.

“While we are very troubled by this situation, our first concern is for those of our international students and scholars who are directly affected. We are working closely with them to offer every support we can,” Schmidt said.

Erin Fitzgerald, the director of international programs at Salve Regina University in Rhode Island, said the school is “very concerned about the impact this order will have.”

Salve Regina is a member of the Syria Consortium, a group of colleges and universities that set aside scholarships for students escaping the ongoing civil war in Syria. Since its inception in 2012, the consortium has helped more than 300 Syrian students, including four currently studying at Salve Regina. On Sunday morning, Fitzgerald said she received an email from an applicant in Damascus who wrote that she was “hopeless because of the news.”

An estimated 17,000 students from the seven countries listed in the ban were studying at U.S. colleges and universities during the 2015-2016 academic year, according to the Institute of International Education. Nearly three-quarters of those students hailed from Iran. All told, foreign students represent about 5 percent of the more than 20 million students enrolled in the nation’s colleges, with most coming from China, India, South Korea and ­Saudi ­Arabia.

The number of international students in the country has risen 73 percent over the past decade, according to Moody’s Investors Service, which warned late last year of the financial pressure colleges and universities could face if the new administration curtailed immigration.

International students receive little to no financial aid and pay higher tuition, making them a crucial source of revenue for public colleges with meager state investment and small private universities with sagging enrollment. In 2015, college students from overseas contributed more than $35 billion to the U.S. economy, according to the Commerce ­Department. But that money could dry up in the face of stringent immigration policies, including Trump’s promise to limit H-1B visas for high-skilled foreign workers.

Arvin Kakekhani, a 28-year-old Iranian student who came to the United States on a student visa to attend Yale University and earned his doctorate in physics there, has extended his visa to do postdoctoral work at Stanford University in the chemical engineering department. He has not gone back to Iran in 61/2 years here, although he misses his family, because he has been concerned that he might not be allowed to return.

“I didn’t want to risk going back,” he said by phone Sunday. “But right now it’s not a risk. Right now it’s 100 percent: If you go out of the country, 100 percent you cannot come back.”

He’s concerned he may not be able to continue his research; he has an Optional Practical Training extension of his F1 student visa that must be extended in four months if he is to continue his studies. “The executive order is at least 90 days,” he said.

He is wondering if he should plan now to leave the United States and look for jobs or postdoc opportunities in Europe or Canada.

“Everything is so uncertain. . . . It’s unbelievable, it’s so shocking that even green-card holders and dual citizens are being subjected to this executive order,” Kakekhani said. “We’re very fearful. We are basically like detainees in this big prison . . . Why are we being punished? What have we done?”

Monica Wang in New Haven, Conn., contributed to this report.