People march as they participate in the '#NoMuslimBanEver' rally in downtown Los Angeles, Calif. Sunday. A federal court in Maryland on Monday heard arguments on whether the third iteration of President Trump’s travel ban is lawful. (Mark Ralston/AFP/Getty Images)

A federal judge on Monday launched skeptical questions at both government lawyers and those challenging the latest iteration of President Trump’s travel ban — probing at what government officials’ intent was in barring various types of people from eight countries from coming to the United States.

At a hearing in federal court in Greenbelt, Md., U.S. District Judge Theodore D. Chuang asked government lawyers about the extent of Trump’s involvement in coming up with the latest ban and what those opposed to the measure felt the president could do so it would pass legal muster.

“This isn’t something the president came up with on his own, correct?” Chuang asked at one point during the proceedings.

The hearing marked one of the last opportunities for challengers of the newest ban to make their case that the judiciary should block the measure before it fully goes into effect Oct. 18. The challenge was brought by advocacy groups including the International Refugee Assistance Project and Muslims who say they will be negatively affected by the ban.

President Trump added North Korea, Chad and Venezuela to his administration's existing travel ban. (The Washington Post)

The case in Maryland is critical, as Chuang blocked the last version of Trump’s travel ban. Those suing hope he will do so again, though judges in Hawaii and Washington, who have also blocked previous versions of the ban, are considering separate requests to intervene.

Trump’s latest travel ban, the third iteration of the measure, affects citizens of eight countries, though some are more completely blocked from coming to the United States than others.

For Syria and North Korea, the directive blocks immigrants wanting to relocate to the United States and non-immigrants wishing to visit in some capacity. For Iran, it blocks both immigrants and non-immigrants, though it exempts students and those participating in a cultural exchange.

The ban blocks people from Chad, Libya and Yemen from coming to the United States as immigrants or on business or tourist visas, and it blocks people from Somalia from coming as immigrants. The proclamation names Venezuela, but it blocks only certain government officials.

At the hearing in Maryland, Chuang asked about the information used to develop the list of banned countries and whether he should consider Trump’s past remarks about Muslims when deciding whether to block the executive order.

Deputy Assistant Attorney General Hashim M. Mooppan stressed that it was officials at the State Department and Department of Homeland Security who helped craft the new directive, which he asserted had “nothing to do with” religion.

Challengers countered that the measure was not as targeted as it could be and that it was poisoned by the president’s past comments about wanting a ban on Muslims. The only explanation for the latest ban was that “it was produced of out desire to express animosity towards Muslims and Islam,” said lawyer Gadeir Abbas.

Legal analysts have said the new measure is more defensible than the previous versions, and those wanting it blocked might have a tougher time convincing a judge to do so. That is because the eight countries affected are not all Muslim-majority — perhaps undercutting the argument that the ban was intended to discriminate on the basis of religion — and Trump signed the measure after an intensive process of assessing the information other countries were able to provide about their travelers.

Chuang did not indicate when he would issue a ruling.

In an earlier version of this article, Hashim M. Mooppan was incorrectly identified as Deputy Attorney General. He is a Deputy Assistant Attorney General.