A federal judge in Seattle Friday struck down a week-old executive order that barred all refugees and travelers from seven Muslim-majority nations from entering the United States — a dramatic move that set the stage for a contentious battle between President Trump and the courts.

The ruling by Judge James Robart, a George W. Bush appointee, nixed Trump’s order and ruled that travel restrictions across the country should be lifted immediately.

“The state has met its burden in demonstrating immediate and irreparable injury,” Robart said.

The judge said Trump’s ban was lifted “on a nationwide basis.”

“The Constitution prevailed today,” said Washington state Attorney General Bob Ferguson, who represented the state in a lawsuit against the order. “No one is above the law — not even the president.”

The US Customs and Border Protection swiftly moved to honor all visas invalidated by the ban, opening the doors to travelers around the world on Friday.

The White House quickly struck back, issuing a statement that said the Justice Department would file an emergency stay of this “outrageous” order.

“The president’s order is intended to protect the homeland and he has the constitutional authority and responsibility to protect the American people,” the statement said.

Minutes later, the White House issued a second statement that excluded the word “outrageous.”

Trump was at his Mar-a-Lago estate in Florida at the time the order came down. He was expected to stay there for the weekend and host a Super Bowl party.

Senate Minority Leader Chuck Schumer (D-NY) quickly pounced on Trump, hailing the decision after the court ruling was issued.

“This ruling is a victory for the Constitution and for all of us who believe this un-American executive order will not make us safer,” Schumer said in a statement. “President Trump should heed this ruling and he ought to back off and repeal the executive order once and for all.”

The decision by Robart set up a legal battle over executive power that could ultimately be fast-tracked to the Supreme Court.

Trump’s order, signed last Friday, sparked protests nationwide and confusion at airports as some travelers were detained or sent back to their points of origin. The White House has argued the order — which barred all refugees for 120 days and non-US citizens traveling from Iran, Iraq, Libya, Sudan, Somalia, Syria and Yemen for 90 days — will make the country safer.

Washington state became the first state to sue over the order. Ferguson, the state attorney general, said the travel ban significantly harms residents and effectively mandates discrimination.

After the ruling, Ferguson said people from the affected countries can now apply for entry to the United States.

The challenge in the Seattle court was brought by the state of Washington and later joined by the state of Minnesota. The judge ruled that the states have legal standing to sue, which could help Democratic attorneys general take on Trump in court on issues beyond immigration.

Washington’s case was based on claims that the state had suffered harm from the ban, citing students and faculty at state-funded universities who were stranded overseas.

With Post Wire Services