Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Acting Attorney General Sally Yates was fired Monday night for defying President Donald Trump's executive order on immigration.

But the very notion of her pushing back at the president was brought up — and encouraged — at her 2015 Senate confirmation hearing as deputy attorney general, when she was grilled about being able to challenge Barack Obama if she disagreed with him.

And who was the man who introduced the idea of dissent?

Republican Alabama Sen. Jeff Sessions, who is now poised to himself become the U.S. Attorney General in the Trump administration.

"You have to watch out because people will be asking you to do things you just need to say 'no' about," Sessions told Yates. "Do you think the attorney general has the responsibility to say no to the president if he asks for something that's improper? A lot of people have defended the [Loretta] Lynch nomination, for example, by saying, 'Well [Obama] appoints somebody who’s going to execute his views. What’s wrong with that?'"

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"But if the views the president wants to execute are unlawful, should the attorney general or the deputy attorney general say 'no?'" Sessions added.

"Senator, I believe the attorney general or the deputy attorney general has an obligation to follow the law and the Constitution," Yates responded, "and to give their independent legal advice to the president."

Yates, who spent her career going after white-collar criminals in the Atlanta area and also prosecuted Olympic bomber Eric Rudolph, was praised by another senator at that hearing for her abilities as an attorney.

"She will be a hero of the American people, a hero of what’s right," said Sen. Johnny Isakson, R-Ga. "She’ll call them like she sees them, and she will be fair, and she will be just."

Before her firing Monday, Yates had advised the Justice Department not to enforce Trump's executive order barring certain refugees and people from seven Muslim-majority countries from entering the United States — a ban that caused confusion at airports over the weekend and set off protests nationwide. Trump had said the ban was necessary as a precaution against "radical Islamic terrorism" and a way to do "extreme vetting."

Related: Obama Rejects Trump Immigration Orders, Backs Protests

"For as long as I am the acting attorney general, the Department of Justice will not present arguments in defense of the executive order, unless and until I become convinced that it is appropriate to do so," Yates wrote.

The White House in a scathing statement shot back that Yates had "betrayed" the Department of Justice.

"Ms. Yates is an Obama Administration appointee who is weak on borders and very weak on illegal immigration," the White House said.

Yates became acting attorney general while the current Senate continues to deliberate on the nomination of Sessions as the nation's top law enforcement attorney.

The Senate Judiciary Committee is expected to vote Tuesday morning after hearings earlier in the month where Sessions faced two days of tough questioning by Democrats over his past record.

Trump early Tuesday slammed the Democrats on Twitter, demanding they vote on attorney general and his other Cabinet picks. "They should be ashamed of themselves!" he tweeted.