U.S. District Judge Michael Baylson tried to push the Trump and Kenney administrations toward compromise in their bitter "sanctuary city" trial, calling it "a paperwork dispute" that could "be solved with the stroke of a pen."

Despite the judge's admonition on Thursday, the sides did not leap into each other's arms.

The Trump administration wants to withhold about $1.5 million in law-enforcement grant money unless the city agrees to actively assist federal authorities in identifying and turning over undocumented immigrants. The city sued in the summer of 2017, saying the Police Department is not an arm of immigration enforcement, and making it one would badly damage community relations.

There the matter had seemed stuck for months, through court filings and a preliminary injunction and now a trial.

But on Thursday, Baylson said he thought the parties could take a third path, one that would demand minimal concessions and would benefit public safety by keeping undocumented immigrants who have been convicted of crimes off the street.

If the city and federal governments can't agree on a plan on their own, he said, he might do it for them.

"I really believe this is a paperwork dispute," the judge said from the bench after testimony concluded. "I would like to see a modification on both sides."

The money involved is relatively small, compared with the city's $4.4 billion budget. But the principle is big, for Philadelphia and potentially for other sanctuary cities across the United States, which see themselves resisting a Trump administration that aims to hurt immigrants.

At trial, a top supervisor of the Philadelphia office of U.S. Immigration and Customs Enforcement (ICE) testified that Mayor Kenney's decision to limit cooperation has made it harder for agents to locate and detain people who should be deported.

A key issue is the city's refusal to honor ICE detainers. The city says that those are administrative requests, not binding, and that it will respond only if that paperwork is accompanied by a signed warrant from a judge.

City officials say they enforce policies that provide equal treatment regardless of immigration status. People who commit crimes are arrested, period. But the city has no legal power to hold people beyond their scheduled release, officials say. And they say law-abiding, undocumented victims and witnesses of crimes won't come forward if they fear they could be detained and deported.

"At our very foundation, we have to have the trust of our communities," First Deputy Managing Director Brian Abernathy testified as the trial opened on April 30. "People are scared. We believe crimes are going underreported."

However, the Trump administration argues that city policies allow dangerous criminals to be released to prey on the community when they should be deported to their homelands.

Under questioning from Justice Department lawyer Daniel Schwei, Abernathy confirmed that in 2015 the city had in custody an undocumented Honduran man, Ramon Aguirre-Ochoa, also known as Juan Ramon Vasquez.

He had been arrested in 2014 and charged with aggravated assault, but was released the following year when the charges were dropped — even though ICE had issued a detainer requesting that he be held. He was rearrested in 2016, and now is serving eight to 20 years in prison for raping a child, testimony showed.

City officials said at the time they would have turned over the man if the federal government had obtained an arrest warrant.

Speaking from the bench Thursday, the judge did not mention that specific case, but said all citizens share a desire and need for safety.

The city is correct, he said, that it does not need to respond to an administrative ICE detainer for an undocumented immigrant who has never been convicted of a crime and who is being released on bail or his own recognizance.

Such a person is entitled to all due process granted by the law, he said, adding that the Constitution protects people, not just citizens.

But, he said, an undocumented immigrant who has been convicted of a crime, and is being released from prison or being released on bail after being charged with a new crime, is a different matter.

A "criminal alien" has no rights under the law, the judge said, and "something needs to change from them just being released out into the street."

But ICE detainers don't distinguish between someone who is a criminal and someone who overstayed a visa, he said.

What if, the judge suggested, ICE undertook to research the criminal history of people it is seeking to detain? And if the city agreed to turn over undocumented immigrants for whom ICE provided a detainer and proof of criminal conviction?

"I think the city ought to consider that," the judge said. "And I think ICE should think about agreeing to attach evidence that the person is a criminal alien. I think this would be in the public interest."

Though trial testimony concluded Thursday, both sides still must file briefs on assorted legal questions. It is unclear when the judge might rule.