Donald Trump was facing another day of trench warfare with the US Senate and the courts on Tuesday as he struggled to get his team and his conservative agenda on track.

The day began with Democrats, who had occupied the floor of the Senate through the night, trying to block the confirmation of billionaire Betsy DeVos as Trump’s education secretary.

Mike Pence became the first vice-president in history to cast a tie-breaking vote to confirm a cabinet nominee after the defection of two Republicans left the Senate deadlocked at 50 votes to 50.

In the afternoon, the fight was due to turn to the courts as Trump’s justice department prepared to mount a fresh argument aiming to resume his controversial ban on visitors to the US from seven Muslim-majority countries and a 120-day outright suspension of all refugees entering the country.

A spokesman for the ninth US circuit court of appeals said it was unlikely the court would issue a ruling Tuesday in the lawsuit over Trump’s travel ban. A ruling was more likely later in the week, David Madden said.

DeVos, a Republican mega-donor and conservative activist, had emerged as Trump’s most controversial cabinet pick amid a public outcry over her lack of experience and record of advocating for school vouchers as part of a broader push toward privatizing the education system.

Two Republican senators, Lisa Murkowski of Alaska and Susan Collins of Maine, broke with the party ranks to oppose her nomination. While Pence ultimately brought DeVos just over the finish line, the rancor over her confirmation was a sign of the resistance to come as the Trump administration seeks to advance its agenda.

Several of Trump’s cabinet nominees remain stalled in the Senate, where Democrats have boycotted committee votes and drawn upon other delaying tactics to thwart the president assembling his administration.

Steven Mnuchin, a former Goldman Sachs executive, awaits a vote to head the treasury department, while Georgia representative Tom Price has yet to be confirmed as the next secretary of health and human services. The Senate moved to a debate on Tuesday over Jeff Sessions, a rightwing senator from Alabama who holds staunch views against immigration and voting rights, for the post of attorney general.

All three are expected to eventually clear the chamber along party lines, with unanimous support from Republicans even as Democrats have sought to mount public opposition to what Chuck Schumer, the Senate Democratic leader, has called “a historically unqualified cabinet”.

The Democratic resistance to Trump’s nominees has escalated in the wake of the president’s travel ban on Muslim-majority countries, which remains embroiled in a legal battle after a federal judge temporarily blocked the executive order last week.

Trump on Tuesday threatened to take the fight to the supreme court, reiterating his claim that the travel ban was a matter of national security.

“Hopefully it doesn’t have to. It’s common sense,” Trump said of his order, which barred immigrants from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen from entering the US for a period of 90 days and suspended all refugee admissions for 120 days.

“We’re going to take it through the system,” he added. “It’s very important for the country.”

Trump’s comments were made against the backdrop of oral arguments in the challenge to his travel ban, brought against the administration by the attorney generals of Washington state and Minnesota.

Three federal judges at the ninth US circuit court of appeals were poised to hear arguments from both sides on Tuesday.

The case was brought before the San Francisco-based court after the Trump administration challenged a ruling on Friday by James Robart, a federal judge appointed by George W Bush, that halted key provisions of the travel ban.

The decisionwas immediately decried by Trump, who derided Robart on Twitter as a “so-called judge” and went so far as to suggest he should be blamed in the event of a terrorist attack.

While taking questions from reporters on Tuesday, Trump continued to question the independence of the judiciary branch of government.

“They want to take a lot of our powers away. Some people with the wrong intentions,” Trump said.

Sean Spicer takes questions from reporters during the daily press briefing at the White House on Tuesday. Photograph: Chip Somodevilla/Getty Images

The White House press secretary, Sean Spicer, downplayed Trump’s attacks on Robart on Tuesday, insisting the president appreciated the separation of powers.

“There’s no question the president respects the judicial branch,” Spicer told reporters at his daily press briefing.

Spicer emphasized the administration’s confidence that the appeals court would rule in its favor, dubbing the law as “crystal clear” with respect to the president’s authority.

“The president has the discretion to do what’s necessary to keep the country safe,” he said.

Regardless of the outcome in the appeals court, he added, “the merits of the case … are ones that we feel very confident on.”

Pressed further on Trump’s assertion that Robart and the court system would be responsible for a terrorist attack, Spicer refused to engage.

“The tweet was pretty clear,” he said.

The House speaker, Paul Ryan, also defended Trump’s criticism of the judge, noting that despite the president’s tweets the administration was following the appropriate process to challenge the ruling.

“He’s not the first president to get frustrated with a ruling from a court,” Ryan told reporters on Tuesday on Capitol Hill.

“Look, I know he’s an unconventional president. He gets frustrated with judges. We get frustrated with judges,” Ryan added. “But he’s respecting the process and I think that’s what counts at the end of the day.”

In a court filing against the administration, attorneys for Washington state and Minnesota said on Monday Trump had “unleashed chaos” with the stroke of his pen. Reinstating the travel ban, they argued, would once again have the effect of “separating families, stranding our university students and faculty, and barring travel”.

Lawyers for the justice department countered the travel ban was “a lawful exercise of the president’s authority over the entry of aliens into the United States and the admission of refugees”.

Non-citizens outside the US, they added, held “no substantive right or basis for judicial review in the denial of a visa at all”.

A group of students, who walked out of New York-area schools, gather for a protest against the Trump administration in New York on Tuesday. Photograph: Justin Lane/EPA

Hours before the arguments were set to begin, John Kelly, the secretary for the Department of Homeland Security, defended the travel ban while testifying before members of Congress on Tuesday by warning of a future terrorist attack.

“Let’s just say, for instance, a person who is trying to get to the United States to do some harm, some terrorist attack, is coming in during this period that the courts put a stay on our enforcement,” Kelly said during a hearing before the House committee on homeland security.

“We don’t know that until an individual who’s a bad person, until they do something bad … But it’s entirely possible that someone that’s coming in, whether it’s during this stay court action or previous to this, they intend to do us harm.”

Pressed by Democrats on the panel for proof that those barred from entering the country through Trump’s order posed such a threat, Kelly continued to sound alarm bells.

“Not until the boom,” Kelly responded. “Not until they blow something up and go into a mall and kill people. Not until then.”

An analysis of terrorist attacks on US soil between 1975 and 2015, published by the Cato Institute last month, found that foreign nationals from the seven countries singled out by Trump’s executive order have killed zero Americans.