WASHINGTON — Senators of both parties pledged Tuesday to work toward finding a solution for Dreamers after President Donald Trump announced plans to end the program protecting young immigrants who were illegally brought to the U.S. as children.

As the Senate opened its first hearing on the issue since Trump's announcement last month, Michael Dougherty, an assistant secretary at the Department of Homeland Security, said Trump would like Congress to work something out.

"They are a benefit to this country," Dougherty said of the young immigrants known as Dreamers. "They are a valuable contribution to our society."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"Under a rational bill, these individuals would be allowed to become lawful permanent residents," Dougherty said.

But highlighting the challenges ahead, the Senate Judiciary Committee hearing featured Republicans' demanding increased border security as part of any deal, while Democrats focused on the plight of the nearly 800,000 Dreamers themselves. These immigrants received temporary work permits and deportation protections under an Obama administration program, but now face a frighteningly uncertain future.

When Trump announced last month he was ending the program, known as Deferred Action for Childhood Arrivals, or DACA, he gave Congress six months to come up with a solution. If there is no action by early March, the immigrants' work permits will begin to expire and they will become subject to deportation, administration officials said as dozens of Dreamers in orange shirts watched from the audience. The Trump administration and congressional Republicans say DACA is unconstitutional and argue that President Barack Obama exceeded his authority in creating it.

"Creating a legislative fix is the right thing to do, but there's a big caveat," said Sen. John Cornyn of Texas, who was among a small group of GOP lawmakers focused on the issue who dined with Trump at the White House on Monday night.

"Before we provide legal status to these young people, we must reassure and actually regain the public confidence that we're serious when it comes to enforcing the law and securing our border," Cornyn said.

Sen. Dianne Feinstein, a Democrat whose home state of California is home to large numbers of Dreamers, countered that "these youths should not be political footballs."

"These young people have put their trust in the federal government and they have done everything asked of them," she said. "They are counting on us to put aside partisanship and find a solution to this problem."

Congressional Democratic leaders, Rep. Nancy Pelosi of California and Sen. Chuck Schumer of New York, announced an agreement with Trump last month to enshrine the DACA protections in law, while separately addressing the issue of Trump's promised border wall. But the terms of the deal quickly came into dispute with Republicans denying there was one at all.

Senate Judiciary Committee Chairman Chuck Grassley of Iowa opened the hearing saying a compromise was in reach, but any plan "has to include robust border security, and by that, I don't mean a wall."