A divided Supreme Court on Thursday blocked President Obama’s plan to spare millions of illegal immigrants from deportation in a ruling hailed by Republicans who accused him of overstepping his powers.

The 4-4 decision, coming seven months before Obama’s term in office ends, was the latest defeat for one of the president’s major policy initiatives.

Republicans lauded the outcome, arguing that Obama’s executive order authorizing the plan was illegal because it bypassed Congress.

Obama unveiled the plan in November 2014, but it was challenged by Texas and 25 other states. The ruling will likely become an even bigger issue in the presidential race.

Because the court was split, a 2015 lower-court ruling blocking Obama’s plan was left in place.

Obama said that if Congress had accepted his Supreme Court nominee, federal Judge Merrick Garland, his order would have been upheld.

The plan was tailored to let roughly 4 million people — those who have lived illegally in the US at least since 2010, have no criminal record and have children who are US citizens or lawful permanent residents — get into a program that shields them from deportation and supplies work permits.