COLOGNE, Germany — The last time Henriette Reker ran for mayor, she was nearly killed.

Ms. Reker was handing out flowers to voters at a bustling market in Cologne in 2015, when a man took a rose with one hand and rammed a kitchen knife into her throat with the other. He wanted to punish her for her pro-refugee stance.

Five years later, Ms. Reker is running again. But she is an exception. Since she recovered from a coma to find herself elected, far-right death threats have become an everyday reality, not just for her but for an increasing number of local officials across Germany.

The acrimony is felt in town halls and village streets, where mayors now find themselves the targets of threats and intimidation. The effect has been chilling.

Some have stopped speaking out. Many have quit, tried to arm themselves or taken on police protection. The risks have mounted to such an extent that some German towns are unable to field candidates for leadership at all.