The news of his illness comes three years after he was elected, becoming Brooklyn’s first black district attorney. He defeated Charles J. Hynes, an incumbent of more than 20 years who had been weakened by accusations of favoritism toward political supporters in Brooklyn’s Orthodox Jewish community, and of allegations of campaign-finance improprieties.

Mr. Thompson, 50, a Democrat, had previously had a successful private law practice; he represented Nafissatou Diallo, a Manhattan hotel housekeeper who, in 2011, accused the French politician Dominique Strauss-Kahn of sexually assaulting her in a case that was eventually dropped by the Manhattan district attorney’s office.

Mr. Thompson had also worked as a federal prosecutor in Brooklyn and delivered a memorable opening argument at the trial of Justin Volpe, a police officer who pleaded guilty in 1999 to torturing a Haitian immigrant, Abner Louima, with a broken broomstick in a Brooklyn station house.

Having run on an agenda of reform and racial justice, Mr. Thompson, once in office, earned a reputation as both an advocate for minority communities in a section of the city known for its divisions between black and white residents and, simultaneously, as a tough law-enforcement officer who concentrated on cracking down on gun crimes and violent street gangs.

Brushing aside the resistance of the New York Police Department, he announced in July 2014 that his office would stop prosecuting most low-level marijuana arrests. He also put in place an amnesty program for people with outstanding warrants. Among his best-known efforts was the creation of one of the country’s most robust internal units dedicated to reviewing wrongful convictions, which in the past two years has exonerated 20 defendants.