A German state premier was elected with the support of the nationalist Alternative for Germany (AfD).