Can President Trump and the Republican-majority Congress make a deal? That's a question raised by the announcement that the administration will end the DACA program in six months, providing legal status to illegal immigrants who entered the United States as children and who don't have serious criminal records and are working or in school or the military.

Trump is on strong legal ground. Former President Barack Obama established DACA in 2012 by executive order, even though (as he had earlier explained) the Constitution gives Congress, not the president, the authority to set policy on immigration and naturalization.

Moreover, Obama's 2014 DAPA executive order, giving legal status to some 4 million parents of legal residents, has been ruled invalid by federal courts and the Supreme Court has blocked its enforcement. Ten state attorneys general have been threatening to challenge DACA on identical grounds.

Attorney General Jeff Sessions is thus right when he says that DACA could be overturned by the courts, leaving the 800,000 young people currently covered with no legal status. They are better off with Trump's order leaving DACA in place for six months than they might be then.

If DACA is, as Democratic Sen. Dianne Feinstein agreed, "on shaky legal ground," the political case for the policy is strong. Polls show large majorities in favor, for the reason that Trump cited in his written statement: "I do not favor punishing children, most of whom are now adults, for the actions of their parents." This is an instance, arguably a rare one, of Trump changing his mind after learning more and on reflection.

The equities weigh heavily in its favor. The 800,000 Dreamers who came forward and sought DACA status are no more responsible for the dubious legal basis for Obama's executive order than they are for their parents' decision to bring them in the United States illegally. They qualified under the terms of an action of the United States government, then in force, and have a strong moral case for permanent legal status.

Trump has made it clear that he supports a legislative version of DACA, and it almost certainly has majority support in both houses of Congress. But because some Republicans like Iowa Rep. Steve King are opposed, any majority must be bipartisan. In those circumstances, with Republican majorities controlling the process, there will need to be a bipartisan deal.

Which means that Democrats, who didn't address DACA or other immigration issues when they had the presidency and congressional supermajorities in 2009-10, will have to make concessions to get the issue on the congressional calendar and to produce a version that won't prompt a presidential veto.

Before the Obama Democrats began passing major legislation on a Democrats-only basis, this was standard operating procedure. It produced major education, Medicare and tax legislation in George W. Bush's years and NAFTA, welfare reform and children's health care legislation in Bill Clinton's.

The late Sen. Edward Kennedy was particularly expert in fashioning bipartisan compromises. He would accept provisions he didn't like in return for others he favored and thought more important. He would oppose as "poison pills" amendments which he personally supported but which he believed would cost the bill needed Republican votes. One such poison pill did pass, with the help of the vote of freshman Sen. Barack Obama, and torpedoed the 2007 comprehensive immigration bill that would have been signed by George W. Bush.

Ten years later the facts and opinion on immigration have changed. One possible path forward was suggested by freshman Sen. Tom Cotton, co-sponsor of a different comprehensive immigration bill supported by Trump. Giving young people, who did violate the law though most Americans think they should not be held culpable, will have "negative consequences," Cotton argues, opening up chain migration of low-skill collateral relatives and incentivizing others to bring children in illegally.

So DACA legalization, he says, should be accompanied with his bill's limits on extended family unification migration and with "enhanced enforcement measures" like mandatory e-Verify.

Such provisions will likely be opposed by the lobbies whose ultimate goal has been legalization of almost all 11 million illegals, a measure that was part of the 2007 and 2013 comprehensive bills. But Democrats may have to accept them in order to help the DACA recipients whom, in retrospect, they failed to protect in 2007 and 2009-10.

Much will depend on the deal-making skill of the president and congressional leaders. Will they measure up to the standard set by Ted Kennedy?