Chris Matthews, the veteran political anchor and voluble host of the long-running MSNBC talk show “Hardball,” resigned on Monday night, an abrupt departure from a television perch that made him a fixture of politics and the news media over the past quarter-century.

Mr. Matthews, 74, had faced mounting criticism in recent days over a spate of embarrassing on-air moments, including a comparison of Senator Bernie Sanders’s campaign to the Nazi invasion of France and an interview with Senator Elizabeth Warren in which the anchor was criticized for a condescending and disbelieving tone.

On Saturday, the journalist Laura Bassett published an essay accusing Mr. Matthews of making multiple inappropriate comments about her appearance, reviving longstanding allegations about the anchor’s sexist behavior. By Monday, his position at the news network he helped build had become untenable.

Accompanied by his family, Mr. Matthews walked onto the “Hardball” set inside NBC’s Washington bureau shortly before 7 p.m. to deliver a brief farewell. His longtime crew members, who had been told of his plans roughly an hour earlier, looked on stunned.