The man, said to be in his fifties, shouted Islamophobic slurs as several headscarf-wearing Muslim women were in the waiting room of a clinic owned by a Turkish doctor in the northwestern city of Moenschengladbach, Rheinische Post reported.
He threatened medical assistants and patients with the knife, but was overpowered by three patients in the waiting room. One of the patients was slightly injured in the incident.
The police said the suspect suffered from mental health problems and the incident was not a politically motivated attack.
A local court on Friday ordered him committed to the psychiatric hospital for treatment.
Germany has witnessed growing Islamophobia in recent years fueled by propaganda from far-right parties, which have exploited fears over the refugee crisis and terrorism.
Source: Anadolu Agency