New York City’s criminal justice establishment was stunned Tuesday by news that Brooklyn District Attorney Kenneth Thompson was taking time off after a cancer diagnosis.

Thompson, 50, was elected district attorney in 2013 after besting longtime incumbent Charles J. Hynes in a bitterly contested Democratic primary.

advertisement | advertise on newsday

“As a man of intense faith, I intend to fight and win the battle against this disease,” said Thompson, who didn’t specify the type of cancer. Thompson added that “during the absences occasioned by my treatment and recovery,” the office would be run by chief assistant Eric Gonzalez.

Law enforcement sources said Thompson, who took office on Jan. 1, 2014, has been periodically out of the office in recent months. His staff wouldn’t comment about his exact work schedule. One of his last major news conferences was June 29, when he announced charges in the 2015 murder of an aide to Gov. Andrew M. Cuomo during a J’Ouvert celebration.

“I have no doubt District Attorney Thompson will tackle this challenge with the same resolve and determination with which he serves the people of Brooklyn,” Mayor Bill de Blasio said in a statement.

Several prosecutors issued statements of support Tuesday, including Bronx District Attorney Darcel Clark, Nassau County District Attorney Madeline Singas, and Eastern District U.S. Attorney Robert L. Capers. An NYPD spokesman said Commissioner James O’Neill also wished Thompson well.

With John Riley