WASHINGTON — The Supreme Court agreed Tuesday to an election-year review of President Obama’s executive order to allow up to 5 million undocumented immigrants to “come out of the shadows” and work legally in the US.

The justices said they will consider undoing lower court orders that blocked the plan from taking effect in the midst of a presidential campaign that has already been roiled by the issue.

The case will be argued in April and decided by late June, about a month before both parties gather for their nominating conventions.

The immigrants who would benefit from the administration’s plan are mainly the parents of US citizens and lawful permanent residents.

Texas is leading 26 mainly Republican-dominated states in challenging the Democratic administration’s immigration plan.

So far, the federal courts have sided with the states to keep the administration from issuing work permits and allowing the immigrants to begin receiving some federal benefits.

If the justices eventually side with the administration, that would leave roughly seven months in Obama’s presidency to implement his plans.

At issue is the Deferred Action for Parents of Americans program, which Obama said in late 2014 would allow people who have been in the US more than five years and who have children who are in the country legally to “come out of the shadows and get right with the law.”

Texas quickly led a legal challenge to the program and has won every round in court so far. Most recently, in November, the 5th US Circuit Court of Appeals ruled in favor of the states, prompting the appeal to the Supreme Court.

Solicitor General Donald Verrilli Jr. said in his court filing that allowing those rulings to stand would force millions of people “to continue to work off the books, without the option of lawful employment to provide for their families.”

The administration said Texas and the other states don’t even have the right to challenge the plan in federal court.

The lower courts decided that Texas does have the right, or standing, to sue because at least 500,000 people living in Texas would qualify for work permits and thus become eligible for driver’s licenses, the costs of which are subsidized by the state. “Texas would incur millions of dollars in costs,” the state said in its brief to the Supreme Court.

The future of the estimated 11 million immigrants living in the country illegally has been much discussed by Republican and Democratic presidential candidates. Democratic front-runner Hillary Clinton has pledged to go further than Obama to protect large groups of immigrants from deportation.

Republican candidate Donald Trump has proposed deporting all people who are living in the US illegally, an idea embraced by some GOP candidates and dismissed by others.

Obama said he was spurred to act on his own by Congress’ failure to pass comprehensive immigration legislation.

An earlier program that is not being challenged, Deferred Action for Childhood Arrivals, shields immigrants brought to the country illegally as children. More than 720,000 young immigrants have been granted permission under that program to live and work legally in the United States.

The White House also has shifted its enforcement actions to focus on criminals, those who pose a threat to national security or public safety, and recent border-crossers.

The change means that people who are here illegally but who are not otherwise violating the law are less likely to face deportation.

About 235,000 people were deported in the federal fiscal year that ended Sept. 30, according to the Department of Homeland Security.

That was the smallest number since 2006 and a 42 percent drop since a record high of more than 409,000 in 2012.

Still, the administration drew criticism from Democrats and immigration advocates for raids this month that resulted in the arrest of more than 120 immigrants from Central America who came to the country illegally since 2014. Those recent arrivals are not among immigrants who would benefit from Obama’s plan.