Still regrouping from a federal appeals court's refusal to reinstate President Trump's controversial ban of nationals from seven predominantly Muslim countries, White House lawyers are working on a rewrite of his executive order that could pass legal muster, NBC News has learned.

The work began several days before the Ninth U.S. Circuit Court of Appeals shot down the White House's bid to lift a temporary restraining order on Trump's plan to bar nationals from Iran, Sudan, Libya, Somalia, Syria, Iraq and Yemen from entering the country for 90 days, a senior administration official told NBC.

Trump's legal team still believes it will be eventually proven correct on the merits of the current executive order, the official said. And they are looking into several options, including continuing the court battle as well as signing a new immigration EO "very soon."

More from NBC News:

Trump talks with Chinese president he'll honor 'One China' policy

Former major general demoted in retirement for using credit card at strip clubs

Look up tonight and you'll see a comet, an eclipse, and a full moon



Several sources close to President Trump told MSNBC's Joe Scarborough that White House lawyers and working on language for the executive order that would be able to find favor with the federal courts.



Trump took to Twitter to voice his outrage Thursday minutes after the three-judge panel decided unanimously not to reinstate the ban.

@realDonaldTrump: SEE YOU IN COURT, THE SECURITY OF OUR NATION IS AT STAKE!

"It's a political decision and we're going to see them in court," Trump told reporters.

The judges also dismissed Justice Department arguments that presidential decisions about immigration policy related to national security are not subject to legal review.

"There is no precedent to support his claimed unreviewability, which runs contrary to the fundamental structure of our constitutional democracy," the judges wrote.

The ruling came in response to a ruling by a lower-court judge in Seattle who issued a temporary restraining order last Friday that blocked Trump's so-called "travel ban."

The DOJ argued that Trump had the authority to issue the order and that U.S. District Judge James Robart's restraining order was overly broad and a danger to the public.

The three judges on the panel disagreed.