His removal leaves a void in the fight against corruption and Wall Street crime.
Bharara, 48, was preparing to try former aides and associates of Gov. Andrew M. Cuomo in a bid-rigging case. His office also has been investigating New York Mayor Bill de Blasio's campaign fundraising and the alleged sexting to a 15-year-old girl by disgraced former U.S. Rep. Anthony Weiner.
He also won a record $1.8 billion insider-trading settlement against billionaire Steven A. Cohen's SAC Capital Advisors, and handled major terrorism cases, including the conviction of and life sentence for Times Square bomber Faisal Shahzad.
In a statement praising Bharara for his "integrity, tenacity, and commitment to rooting out wrongdoing," Democratic New York state Attorney General Eric Schneiderman blasted Trump and Attorney General Jeff Sessions.
"President Trump's abrupt and unexplained decision to summarily remove over 40 U.S. Attorneys has once again caused chaos in the federal government and led to questions about whether the Justice Department's vital and non-partisan work will continue under Attorney General Sessions, as it must," Schneiderman said.
Bharara was appointed in 2009 by President Barack Obama. He previously served as chief counsel to Sen. Charles E. Schumer, D-N.Y., who is now Senate minority leader and a vocal critic of Trump.
After receiving the order from acting Deputy Attorney General Dana Boente, Bharara told his staff he had no intention of resigning and was going to be at the office on Monday for work, sources told NBC News.
Some in law enforcement circles suggested that Bharara was essentially daring the Justice Department and the White House to fire him, according to NBC.
After his Twitter announcement, Bharara issued a statement saying, "One hallmark of justice is absolute independence, and that was my touchstone every day."
He said Deputy U.S. Attorney Joon Kim will serve as acting U.S. attorney.
Lawyers mentioned as a possible permanent replacement include Marc Mukasey, according to The New York Times. The newspaper noted that Mukasey is a former federal prosecutor in the Southern District and is now a lawyer at the New York law firm where Trump friend and advisor Rudy Giuliani works.
Bharara's announcement on Twitter came just eight days after he set up his personal account, in which he described himself as a Bruce Springsteen fan, a "Patriotic American & proud immigrant." The first tweet by the India native, on March 3, was rather ominous.