U.S. Sen. Lindsey O. Graham (R-S.C.), flanked by Sen. Richard J. Durbin (D-Ill.), talks about possible legislation for “dreamer” immigrant children. (Jonathan Ernst/Reuters)

Hoping to fend off a legal challenge to a program that has spared nearly 800,000 young immigrants from deportation, two veteran senators made a long-shot appeal to President Trump on Thursday to support legislation that would put those immigrants and thousands of others on a path to U.S. citizenship.

Sen. Richard J. Durbin (D-Ill.) and Sen. Lindsey O. Graham (R-S.C.) introduced “Dream Act” legislation that would grant permanent legal status to more than 1 million young people who arrived in the United States before they turned 18, passed security checks and met other criteria, including enrolling in college, joining the military or finding jobs. Immigrants must have lived in the United States for at least four years to apply.

“I am hoping we can find a pathway forward with President Trump,” Graham said at a news conference. “Wouldn’t it be ironic if the man who started his campaign talking about illegal immigration in a very tough way would be the man who started the country on a path to solving the problem?”

As a candidate, Trump blasted President Barack Obama’s Deferred Action for Childhood Arrivals program, saying it was wrong to bypass Congress and give deportation protection — including Social Security numbers and work permits — to undocumented immigrants who came to the country as children.

Trump, who has made cracking down on illegal immigration a cornerstone of his administration, vowed as a candidate to end the program. But he faltered after taking office, saying he wanted to deal with the immigrant youths with “heart.” His administration has renewed thousands of work permits for DACA recipients and issued new ones, prompting Texas and nine other states to threaten to sue if the administration doesn’t start phasing out the program by Sept. 5.

(Claritza Jimenez/The Washington Post)

With that deadline looming, Durbin said he is actively engaged with the White House on the issue. He first filed “dreamer” legislation 16 years ago; other versions passed the House in 2010 and in the Senate, as part of a larger immigration bill, in 2013. But no bill has ever been passed by both chambers.

Obama created the deferred-action program in 2012 because Congress had not acted on the issue.

“We believe there are people within that White House who want to continue this dialogue and conversation, and we are going to work with them,” Durbin said.

Trump indicated some reason for hope last week, telling reporters on Air Force One that ending DACA is “a decision that’s very, very hard to make.”

“What I’d like to do is a comprehensive immigration plan,” Trump said. “But our country and political forces are not ready yet.”

White House officials signaled this week that the president will not support the Dream Act. “I think that the administration has opposed the Dream Act and likely will be consistent on that,” said Marc Short, the president’s legislative affairs director.

Another White House aide said the president is committed to first enforcing immigration laws and protecting American jobs, and is in talks with the House and the Senate on legislation such as the Davis-Oliver Act, which would crack down on criminal immigrants, and on merit-based changes in the legal immigration system. Trump is also seeking $1.6 billion to start construction of a border wall.

Still, advocates for immigrants hailed the reintroduction of the legislation and said they hoped it would gain traction, especially since the people it would affect are widely viewed as among the most sympathetic of the nation’s 11 million undocumented immigrants.

But critics said they doubted the Republican-controlled Congress would pass the measure.

“Given Congress’s track record . . . I don’t think there’s much of a chance now,” said Jessica Vaughan, director of policy studies for the Center for Immigration Studies and an opponent of DACA.

The Migration Policy Institute estimates that 1.8 million immigrants would qualify for conditional legal status under the proposed Dream Act, and a subset of 1.5 million probably would meet the criteria for green cards. After a five-year waiting period, those in the latter group could apply for U.S. citizenship.

Hundreds of thousands of young immigrants, many of whom have been in the United States since childhood, have received protections from the DACA program. With Obama out of the White House, many are afraid of being deported.

Angelica Villalobos, a mother of four who lives in Oklahoma, said she is reluctant to pin her hopes on Congress. “If DACA is taken away, I won’t be safe,” she said Thursday.

Homeland Security Secretary John F. Kelly said last week that legal advisers have warned him that DACA probably would not survive a court challenge.

Late Thursday, 20 state attorneys general, led by California’s Xavier Becerra, urged Trump to preserve DACA, saying it had been a “boon” to the economy by allowing students to study and work, becoming soldiers, nurses, church leaders and more.

The Democratic officials — including the District’s Karl A. Racine, Maryland’s Brian E. Frosh and Virginia’s Mark R. Herring — offered to help the administration defend the program in court if Texas and other states challenge it.

“The consequences of rescinding DACA would be severe, not just for the hundreds of thousands of young people who rely on the program — and for their employers, schools, universities, and families — but for the country’s economy as a whole,” the attorneys general said in the letter. “And as the chief law officers of our respective states, we strongly believe that DACA has made our communities safer, enabling these young people to report crimes to police without fear of deportation.”

Graham, who also criticized Obama’s decision to bypass Congress and create DACA, said passing a law would avoid the need to have the program survive a court challenge. He made a similar point during the confirmation hearing in January of Attorney General Jeff Sessions.

“The best way to do it is for Congress and the administration to work together and pass a law, not an executive order,” Graham said then.

“Exactly,” Sessions replied.

The Justice Department declined to comment Thursday.

Graham said the United States faces a “moment of reckoning.”

“To President Trump, you’re going to have to make a decision. The campaign is over,” Graham said. “To the Republican Party: Who are we? What do we believe? . . . When they write the history of these times, I’m going to be with these kids.”