From: Rabbi Moshe Sofer
To: Rabbi Ephraim Zalman Margolios
The Chasam Sofer investigates whether a rabbi or chazzan who has sinned may be permanently removed from his communal position, based on a Rambam manuscript cited in the Sha'arei Teshuvah. He rules that city residents cannot serve as witnesses for removal since they are interested parties, but may testify to establish guilt for purposes of punishment alone.
Source: Shu"t Chasam Sofer OC §41