From: Rabbi Moshe Sofer
To: Tchaba
The Chasam Sofer rules that a rabbi guilty of personal religious negligence is admonished privately but not removed. Witnesses from the same town are disqualified by financial interest and enmity and cannot depose the rabbi for his erroneous rulings, though community members who credit the testimony may not rely on his halachic decisions. However, for the public offense of arranging unauthorized gittin after explicit prohibition, no testimony is needed, and the rabbi's title and heter hora'ah are fully revoked.
Source: Shu"t Chasam Sofer CM §162