Los Angeles - A US court on Thursday unanimously refused to reinstate Donald Trump's ban on refugees and nationals from seven Muslim-majority countries, dealing the new president and his controversial law-and-order agenda a major defeat.The ruling from the federal appeals court in San Francisco on Trump's executive order, issued on January 27 with no prior warning and suspended by a lower court a week later, capped a turbulent first three weeks of his presidency.A defiant Trump quickly pledged to battle on, tweeting within minutes of the decision: "SEE YOU IN COURT, THE SECURITY OF OUR NATION IS AT STAKE!"The Justice Department had asked the Ninth Circuit Court of Appeals to restore the measure on an emergency basis, but the three-judge panel instead maintained the suspension ordered by a federal judge in Seattle."We hold that the government has not shown a likelihood of success on the merits of its appeal, nor has it shown that failure to enter a stay would cause irreparable injury," the judges ruled.Trump's decree summarily denied entry to all refugees for 120 days, and travellers from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen for 90 days. Refugees from Syria were blocked indefinitely.The new Republican administration argued the ban was needed to prevent Islamic State and al-Qaeda fighters migrating from reaching US soil, but it sparked travel chaos and was roundly rejected by immigration advocacy groups.Critics say the measure targeted Muslims in violation of US law.Now, the case could end up in the Supreme Court. SEE YOU IN COURT, THE SECURITY OF OUR NATION IS AT STAKE!— Donald J. Trump (@realDonaldTrump) February 9, 2017 Court's logicThe court in San Francisco said aspects of the public interest favoured both sides, highlighting the "massive attention" the case had drawn. "On the one hand, the public has a powerful interest in national security and in the ability of an elected president to enact policies," the ruling said. "And on the other, the public also has an interest in free flow of travel, in avoiding separation of families, and in freedom from discrimination."While acknowledging that the Seattle judge's ruling "may have been over-broad in some respects," the panel said it was not their "role to try, in effect, to rewrite the executive order.""The government has pointed to no evidence that any alien from any of the countries named in the order has perpetrated a terrorist attack in the United States," the court said.'No one is above the law'Civil rights campaigners and state officials applauded the decision, vowing to fight on until the executive order was permanently scrapped. For now, it means that travellers with valid visas can continue to enter the country.Washington Governor Jay Inslee, whose administration sued for the measure to be blocked, hailed a victory for his state and the country, arguing that the ruling showed "no one is above the law, not even the president."Human Rights Watch senior researcher Grace Meng called the decision "an important declaration of judicial independence, which is crucial for checking harmful overreach by the president."Trump had blasted the original suspension and decried the politicisation of the federal courts in a series of fiery tweets and public statements.Republican lawmakers jumped to Trump's defence, with Senator Tom Cotton calling the ruling "misguided," while Democrats predictably hailed it."Pres Trump ought to see the writing on the wall, abandon proposal, roll up his sleeves & come up w/ a real, bipartisan plan to keep us safe," tweeted Senate Democratic minority leader Chuck Schumer.Trump's election rival Hillary Clinton tweeted simply: "3-0".