NEW YORK — Preet Bharara, who as U.S. attorney in the Southern District of New York prosecuted Wall Street figures for financial misdeeds, said he was fired Saturday after refusing to follow the Trump administration’s demand for his resignation.

“I did not resign,” Bharara posted on Twitter. “Moments ago I was fired.”

Attorney General Jeff Sessions on Friday requested Bharara’s resignation and those of other prosecutors appointed by President Barack Obama.

A White House spokeswoman said the White House statement issued Friday “was very clear in saying that all 46 (of the U.S. attorneys being asked to resign) are being treated the same. He is in that group.”

She pointed to a Justice Department statement that said only two of the 46 U.S. attorneys were exempted: U.S. Attorney Dana Boente of Virginia, the acting deputy attorney general, and Maryland U.S. Attorney Rod Rosenstein, who is waiting for the Senate to confirm him as deputy attorney general.

Bharara said earlier that he had received assurances in November from both Donald Trump and Sessions that they wanted him to stay on, and he agreed to do so.

Bharara was appointed by Obama in 2009, and brought convictions of former New York state Assembly Speaker Sheldon Silver, a Democrat, and former Senate Republican leader Dean Skelos. A former aide to Gov. Andrew Cuomo, Joseph Percoco, is expected to go on trial this year, and New York City Mayor Bill de Blasio has been under investigation for a year.

The prosecutor’s Wall Street investigations have targeted hedge funders Raj Rajaratnam, who was convicted, and Steven Cohen, who was never charged.

Bharara’s prosecutors also convicted terrorists such as British cleric Abu Hamza al-Masri and Ahmed Ghailani, one of the planners of the 1998 attacks on two U.S. embassies in Africa, and cybercriminals such as Ross Ulbricht, the founder of the drug website Silk Road.

A graduate of Harvard College and Columbia Law School, Bharara was a federal prosecutor in Manhattan from 2000 to 2005, under U.S. Attorney James Comey, who is now the FBI director.

Bharara later was an aide to Sen. Chuck Schumer and led a Senate Judiciary Committee investigation of the politicized firing of U.S. attorneys under former Attorney General Alberto Gonzalez.