The Supreme Court has appeared sceptical of President Donald Trump's executive order limiting birthright citizenship, a sign the justices could strike down a key element of his immigration agenda.

A majority of the court seemed unconvinced the US should stop granting citizenship to children of undocumented immigrants and some temporary US visitors.

The administration has argued that limiting birthright citizenship is necessary to rein in illegal immigration. Opponents argue it would upend more than a century of precedent and unravel a cornerstone of US immigration law.

Trump attended the oral arguments on Wednesday, a rare move by a sitting president that underscored the case's high stakes.

A defeat for the Republican president would mark a second straight setback at the high court, following the decision last month that invalidated his global tariffs. A win would help Trump deliver on his pledge to reshape America's immigration policies.

US Solicitor General John Sauer sought to convince the justices that the 14th Amendment - which establishes birthright citizenship and was extended to formerly enslaved people - and subsequent court rulings and laws passed by Congress all mistakenly expanded birthright citizenship.

Chief Justice John Roberts, a key swing vote on the court, questioned Trump's authority to exclude children of undocumented immigrants from receiving US citizenship.

The oral arguments turned on a key clause in the 14th Amendment, which grants citizenship to all people born or naturalised in the US who are subject to the jurisdiction thereof.

Justice Elena Kagan said the administration was seeking to undo a legal tradition of birthright citizenship that dates back to English common law.

Cecilia Wang, an ACLU attorney representing the plaintiffs, used the landmark Supreme Court ruling, United States v Wong Kim Ark, to argue that Trump's executive order should be overturned.

Whether the court ultimately issues a broad or narrow opinion remains to be seen, with a decision expected in June. This case represents the first significant immigration decision from the court under Trump's administration.