Media playback is unsupported on your device Media caption Barack Obama said the decision is a "clear reminder of why it is so important for the Supreme Court to have a full bench"

The Supreme Court has announced it is split on President Barack Obama’s plan to shield millions of undocumented immigrants living illegally in the US.

The divide comes as a blow to the president's 2014 executive action which he enacted without Congress and will now be assessed in a lower court.

Republican House Speaker Paul Ryan applauded the news, saying only Congress should write laws.

But the president said the deadlock was "heartbreaking" for millions of people.

"They are Americans in every way but on paper," he said at the White House, adding that reform will happen, sooner or later.

"Congress is not going to be able to ignore America forever," he said.

Texas led 26 Republican-led states in challenging the programme, which would have given the right to work to millions of people.

The deadlock between the eight judges was only possible because of the death of the ninth, Justice Antonin Scalia, leaving a vacancy that is still unfilled.

This is the first tied decision produced by the court, as the Senate continues to block Mr Obama's nominee, Judge Merrick Garland.

Analysis - Anthony Zurcher, BBC News, Washington

The deadlocked decision in US v Texas is the clearest example to date of the impact that Justice Antonin Scalia's death has had on the US Supreme Court - and, consequently, on the direction of US public policy writ large.

The court's inability to find a majority either supporting President Barack Obama's unilateral executive action on immigration or striking it down means the whole controversy heads back into the lap of a lower-level conservative judge in Texas.

While those judicial gears slowly grind away, the US has a presidential election to conduct in just over four months.

If the Senate continues to drag its feet on confirming Mr Obama's pick for the high court, Merrick Garland, the next president could not only set US immigration policy but also pick the justice who will likely be the deciding vote if and when those decisions once again reach the Supreme Court.

Given that US voters are choosing between Hillary Clinton and Donald Trump, the disposition of the immigration issue for generations to come is in the balance. As if the stakes in the US presidential election weren't high enough already.

Media playback is unsupported on your device Media caption The US-Mexican family split by the border

The Deferred Action for Childhood Arrivals (DACA) and the Deferred Action for Parents of Americans (DAPA) initiatives had been on hold since 2015 as the court considered the programmes' legality.

DAPA was considered particularly controversial as it allows the parents of US citizens and permanent residents to remain in the county for up to three years and apply for work permits.

Lawyers for the state of Texas argued that state governments would be overburdened by having to spend more on public services with the addition of the undocumented residents.

Image copyright Getty Images Image caption Supporters of immigration reform rally in Miami during the April Supreme Court trial

Image copyright Getty Images Image caption Supporters of immigration reform decry the deadlocked ruling outside the Supreme Court

The lack of ruling leaves the legal status of about four million undocumented immigrants in limbo.

President Obama's unilateral action would have allowed migrants to obtain work permits and would block them from deportation while their citizenship status was being determined by lawmakers.

Democratic candidate Hillary Clinton called the courts deadlocked opinion "unacceptable" and said that immigrants "enrich our communities and contribute to our economy every day".

"We should be doing everything possible under the law to provide them relief from the spectre of deportation," Mrs Clinton said in a statement.

Republican lawmaker Paul Ryan applauded the Supreme Court for making "the president's executive action on immigration null and void".

"The Constitution is clear: The president is not permitted to write laws, only Congress is."

Mr Ryan, the top-ranking elected Republican, is at odds with the party's presidential nominee-to-be Donald Trump over his plans to build a wall on the southern border paid for by Mexico.

What is in Obama's plan?