Candidate-mayors just apply to a job opening and the municipal council decides. “Appointed by national government” is the formality.
National government can theoretically decide not to install the municipality preference, but AFAIK that has never happened.