James B. Comey, the former F.B.I. director, days before he was fired last May. Although he appears to disdain partisanship, he has sharply criticized President Trump while promoting his own book.

WASHINGTON — For decades, James B. Comey cultivated an image of purity as a lawman who stood above politics and politicians.

Then came the book tour.

With the release of his memoir this week and a set of high-profile media interviews to publicize it, Mr. Comey — whose firing by President Trump made him a hero to the president’s critics — has veered onto risky terrain, shedding the trappings of a high-minded referee and looking instead like a combatant in the country’s partisan battles.

Mr. Comey’s description of the president as an unethical liar “morally unfit” for office; his call for voters to decide Mr. Trump’s fate at the ballot box in 2020; and even his observations about Mr. Trump’s appearance — his “orange” skin, his too-long ties, his hands — are stark departures from the law-enforcement mission of his old agency, the Federal Bureau of Investigation.

The personal potshots in particular have surprised some former colleagues who thought of Mr. Comey as relatively sober and serious. Observers on both the left and right — including many who count themselves as fierce critics of Mr. Trump’s — say that in embarking on his star turn, Mr. Comey may be undercutting his own indictment of the president’s character and conduct.

“The real impact of having the former head of the F.B.I. calling the president unfit is dependent on the just-the-facts professional image of the F.B.I.,” said Michael Steel, a Republican strategist who has been critical of Mr. Trump. “To the extent that the former director appears petty and anything less than high-minded, it diminishes the impact of his critique.”

“In a time when almost every public debate is defined by people lining up with their respective tribes,” Mr. Steel added, “he’s managed to alienate both.”

Mr. Comey, in remarks promoting the book, says he is trying to rouse the country to see Mr. Trump through the lens of “ethical leadership,” arguing that the president “does not reflect the values” of Democrats, Republicans or independents. Asked on ABC if Mr. Trump should be impeached, Mr. Comey said he hoped it would not happen because voters were “duty bound” to “go to the voting booth and vote their values.”

Mr. Comey has cast himself as a truth-teller before, sometimes to the irritation of colleagues or superiors. He threatened to quit his job at the Justice Department in the George W. Bush administration rather than sign off on a domestic surveillance program the White House demanded, and he refused Mr. Trump’s entreaties to back off of the investigation of Michael T. Flynn, his former national security adviser. Mr. Trump fired Mr. Comey a few months later, calling him a “grandstander” and citing the F.B.I.’s investigation into…