Months after her high-profile firing by President Trump, former acting Attorney General Sally Yates testified in front of the U.S. Senate on Monday. Yates famously refused to defend Trump's travel ban in court, which is what led to her firing, and several senators questioned her about this decision on Monday. One of them was failed presidential candidate Ted Cruz, who attempted to impugn her judgement on the travel ban. And yet despite his reputation as a stellar debater, Ted Cruz's interrogation of Sally Yates backfired spectacularly, and according to several reports, he got up and left the hearing before it was over.

Cruz adopted several lines of attack against Yates, none of which worked. First, he cited a section of U.S. code that, in his interpretation, granted Trump the authority to issue the Muslim ban, and implicitly criticized Yates for not being able to identify that section of law by name.

"Are you familiar with 8 U.S.C. Section 1132?" Cruz asked.

"Not off the top of my head, no," Yates replied.

"Well, it is the binding statutory authority for the executive order that you refused to implement and that led to your termination, so it certainly is a relevant and not terribly obscure statute," Cruz said.

He then cited the text of the statute, which says that if the president "finds that the entry of any alien or of any class of aliens into the United States would be detrimental to the interests of the United States, he may, by proclamation and for such a period as he shall deem necessary, suspend the entry of all aliens or any class of aliens as immigrants or non immigrants, or impose on the entry of aliens any restrictions that he deems appropriate.'"

"Would you agree that that is broad statutory authorization?" Cruz asked Yates. Evidently, she had prepared for this.

"I would, and I am familiar with that," Yates responded. "And I'm also familiar with an additional provision [of the Immigration and Nationality Act] that says, 'No person shall receive preference or be discriminated against in issuance of a visa because of race, nationality or place of birth.' That I believe was promulgated after the statue you just quoted and that's been part of the discussion with the courts, with respect to the INA, was whether this more specific statue trumps the first one you just described."

Cruz attempted to interject, but Yates continued.

"But my concern was not an INA concern here," she explained. "It rather was a Constitutional concern, whether or not the executive order here violated the Constitution specifically with the establishment clause and equal protection and due process."

The junior senator from Texas grumbled that he expected "partisan litigants" to make that same argument in court. He did not, however, address the substance of Yates' argument.

Instead, he noted that the Justice Department's own legal counsel had determined days earlier that the executive order on travel was lawful, and asked Yates why she drew the opposite conclusion.

"You determined, using your own words, that although LLC had opined on legality, it had not addressed whether [the executive order] was 'wise or just,' Cruz said.

"And I also — in that same directive, Senator — said that I was not convinced that it was lawful," Yates replied. "In this particular instance, particularly where we were talking about a fundamental issue of religious freedom, not the interpretation of some arcane statute, but religious freedom, it was appropriate for us to look at the intent behind the president's executive actions, and the intent is laid out in his statements —"

Cruz interrupted her and tried one more time.

"In the over 200 years of Department of Justice history, are you aware of any instance in which the Department of Justice has formally approved the legality of a policy and three days later, the Attorney General has directed the department not to follow that policy and to defy that policy?" Cruz asked.

"I'm not, but I'm also not aware of a situation where the office of legal counsel was advised not to tell the Attorney General about a policy until after it was over," she replied.

Progressives on Twitter were delighted with Yates' deft handling of Cruz's questions, and even some conservatives acknowledged that the exchange made Cruz look bad.

According to The Daily Beast's Tim Mak, Cruz left the Senate chamber shortly after his questioning of Yates. That's how bad it went.

The exchange revealed that Cruz, his reputation as an orator notwithstanding, is more than capable of embarrassing himself when confronted with someone who's a better debater than he is — and Yates is a better debater than he is.