Andreas Hollstein, 54, mayor of the western town of Altena, was stabbed Monday evening at a kebab shop by a man who had loudly criticised his liberal refugee policy.
Hollstein said that without two shop employees who rushed to help him, he would "probably not be here today".
With a large bandage on his neck and a wavering voice, Hollstein told reporters that the 56-year-old male assailant had asked him if he was the mayor before pulling the knife and then said: "You let me die of thirst and take in 200 refugees in Altena."
Merkel, who has faced a strong backlash over her welcoming stance toward refugees, was "horrified" by the attack on Hollstein and "very relieved that he was already able to return to his family," her spokesman Steffen Seibert tweeted. "Thanks also to those who helped him."
Hollstein, a member of Merkel's Christian Democrats (CDU), said that he believed "a coarsening of the public debate about refugees" had led to the assault.
"I even received emails today approving of the attack -- that says something about the state of our country," he said, adding that he and his family had received repeated threats in recent years.
Hollstein said the attacker appeared to be under the influence of alcohol but was by no means incapacitated, noting it had taken three men to overpower him.
The assailant was arrested at the scene while Hollstein was taken to a local hospital and, after treatment, released hours later, police said in a statement, referring to an "apparent xenophobic motive".
'Like a good mayor should'
The snack shop owner, Demir Abdullah, who came to Hollstein's aid along with his son, who was also injured in the attack, confirmed the assailant had specifically targeted Hollstein.
"He asked 'are you the mayor?'... then he reached for his knife and stabbed him in the neck," Abdullah told German television.
The town of about 17,000 people was well known for taking in a larger share of asylum seekers than required amid the mass influx that has brought more than one million migrants and refugees to Germany since 2015.
Hollstein, whose town won a national award in May for its work with refugees, said Altena had welcomed about 450 people and said he had no plans to reverse his stance.
"I'm going to continue to work for refugees, for those who are already here and for those who are still arriving, for the weak and the strong in our society, like a good mayor should," he said.
Justice Minister Heiko Maas tweeted that "we must never accept that people are attacked because they help others," adding that there was no space "for hate and violence" in Germany.
The assault revived memories of a knife attack on Cologne's mayor Henriette Reker in October 2015 by a right-wing extremist who was angered at her welcoming stance toward refugees.
The brutal attack came at the height of the influx to Germany, where sentiment is still deeply divided on the country's humanitarian responsibilities and its ability to integrate newcomers.
While most mainstream parties back the principle of Germany taking in people fleeing warzones such as Syria, the backlash led the far-right Alternative for Germany party to win its first seats in parliament in September's general election.
Although Merkel won a fourth term in the poll, the AfD's presence has severely complicated her efforts to cobble together a ruling coalition.
The AfD scored nearly 12 percent of the vote in Altena's electoral district, just below the 13 percent it drew nationally.