Mr. Warren was indicted after Mr. Trump’s first attorney general, Jeff Sessions, directed federal prosecutors to prioritize cases involving the harboring of undocumented immigrants. In the past, the anti-harboring law has been used mainly against smugglers who transport migrants for profit, and occasionally against employers who knowingly recruit undocumented workers.

The trial of Mr. Warren was marked with protests outside the courthouse and other shows of support for him and his group. Faith leaders, health workers, educators and community members filled the courtroom. About 125,000 people signed an online petition demanding that the case be dismissed.

Mr. Warren’s defense lawyers said that their client was targeted by the Justice Department because No More Deaths had distributed a video showing Border Patrol agents destroying jugs of water that the group had placed in the desert. Mr. Warren was arrested a few hours after the video was posted online. A spokesman for Customs and Border Protection, Robert Daniels, said the agency could not comment during the pending prosecution.

Border Patrol agents arrested Mr. Warren and the two migrants — Kristian Perez Villanueva, from El Salvador, and Jose Sacaria Goday, from Honduras — on Jan. 17, 2018, at a house called the Barn, about 110 miles from Tucson. The site serves as a base camp for No More Deaths; the group’s volunteers congregate there, store provisions in its shed and set out from there to search the desert for migrants’ remains.

Mr. Perez said in a videotaped deposition that he and Mr. Sacaria had crossed the border near the Mexican town of Sonoyta with some other men by climbing a fence. On Jan. 17, he said, after walking for eight hours, guided through the desert by a compass and the stars, the two men reached a gas station, where a man offered to drive them to a place to rest. That place was the Barn, located in Ajo, a town of about 3,000 people some 32 miles north of the border.

That driver was identified by prosecutors and a Border Patrol agent as Irineo Mujica, a Mexican-American with dual citizenship who is a leader of the Pueblo Sin Fronteras, a group that has organized caravans from Central America to the United States and operates a shelter on the Mexican side of the border. He was arrested by Mexican authorities last week.

The migrants found no one at the Barn but managed to gain access to a bathroom on the property, according to Mr. Sacaria. When Mr. Warren arrived about 40 minutes later, he said, “We just asked him to let us rest for a few days, one or two days, that we were going to leave.”