He has the legal right to do it, and at this point, even a moral imperative — but President Barack Obama taking immigration law into his own hands is going to set in motion forces that could either bring more meaningful reform or set back the cause for years.

And not just because it will turn Republicans into frothing attack dogs a little more than a month before they take control of both houses of Congress.

Sure, Obama’s unilateral action exacerbates an already poisonous partisan divide in our government, but it also is incomplete and probably not for the long-term.

We get that the president felt, after years of Republican double-talk and inaction, he had to do something. Then again, a little more than a year ago, after he also acted unilaterally to suspend deportations of young immigrants brought to the United States illegally by their parents, he said any broadening of his order needed to go through Congress.

“The notion that somehow I can just change the laws unilaterally is just not true,” he also said.

Congress did nothing and, obviously, he changed his mind. His new order will extend protection to nearly 5 million undocumented immigrants — and clearly the White House believes he has the legal right to do it, and that precedent is on the president’s side. Republican Presidents Ronald Reagan and George H.W. Bush granted blanket deferrals to groups of immigrants not covered under the amnesties in a 1986 immigration reform bill. The difference, of course, is that those actions expanded an existing law, and were not taken as “prosecutorial discretion,” the phrasing the president is using to justify this action.

Obama’s bold move allows him to declare certain groups of immigrants a low priority for deportation — parents whose children are already U.S. citizens or legal permanent residents. The protection would apply only to parents who have lived in the United States for five years or more. Obama’s action will give millions of people some relief from the chronic fear they’re going to be sent packing, and allow some to apply for work permits now available only to immigrants with legal status.

Obama’s immigration plan also extends an existing 2012 program deferring deportations of nearly 600,000 “dreamers” — young people brought to the country illegally as children. And it expands visas for high-skilled workers, modifies federal immigrant-detention procedures and directs more federal resources to boost border security.

But Obama’s order does not grant them any long-term legal status. Nor does it do anything about stopping employers from hiring illegal workers. Millions of people are excluded from the action. And it can be undone by the next president, which should further energize Republicans in their 2016 bid to take the White House.

Politically, Obama’s move helps Democrats in maintaining a critical voting bloc among Hispanics. Republicans counter that this is yet another broad overreach by an imperial president, who cannot, or will not, work with those who dare disagree with him.

Republican leaders should also be concerned that an overreaction on their part — trying to shut down the government again — will cost them credibility as they’re getting ready to take full control of Congress.

But Obama wasn’t going to wait any longer for a complete immigration package. Instead, he’s willing to push the limits of executive authority and do what immigration advocates have long urged him to do. And that’s troubling, since it opens up the specter of future presidents going even further under the rubric of “discretion.”

At the same time, Republicans knew immigration reform was badly needed — and they chose not to act.

Now Obama has acted. Rather than react in petulance, it isn’t too late for Congress to do what needs to be done: Create an immigration system that protects workers and families from unjust laws while providing legal pathways to citizenship.