A top official in Germany warned the country's Jewish community on Saturday to avoid wearing the traditional skullcap in public places in certain areas amid a rise in hate crimes.

Commissioner Felix Klein was speaking on the rise in anti-Semitic attacks across the country, and told the Funke media group that his opinion on wearing the skullcap -- also called a yarmulke or kippah -- has "unfortunately changed compared with what it used to be."

"I cannot recommend to Jews that they wear the skullcap at all times everywhere in Germany," Klein said in an interview without elaborating on what places and times might be risky.

EU ELECTIONS PRIMER: HOW THEY WORK, WHAT COULD HAPPEN

Government statistics released earlier this month showed that the number of anti-Semitic and anti-foreigner incidents rose in Germany last year, despite an overall drop in politically motivated crimes. Attacks against Jews in Germany were up by 10 percent from 2017 to 2018, with reported violent cases up from 37 to 62 over the same period, according to German public broadcaster Deutsche Welle.

Israeli President Reuven Rivlin said Sunday he is shocked by a statement by Felix Klein, the government's anti-Semitism commissioner, that he wouldn't advise Jews to wear skullcaps in parts of the country for their safety. (AP Photo/Markus Schreiber)

Israel's president said Sunday he was shocked by the German official's comment.

"The statement of the German government's anti-Semitism commissioner that it would be preferable for Jews not wear a kippa in Germany out of fear for their safety, shocked me deeply," Israeli President Reuven Rivlin said in a statement.

He added that "we will never submit, will never lower our gaze and will never react to anti-Semitism with defeatism — and expect and demand our allies act in the same way."

AUSTRIAN GOVERNMENT, THE BLUEPRINT FOR EUROPE’S NEW WAVE OF POPULISM, FIGHTING FOR ITS POLITICAL LIFE

Klein's comments came after a similar warning from the head of Germany's leading Jewish organization last year when two men wearing skullcaps were assaulted by a group of men in Berlin, according to Sky News.

Josef Schuster, head of the Central Council of Jews in Germany, told German radio at the time: "I have to advise people to avoid showing themselves openly with a kippa in a big city setting in Germany, and to wear a baseball cap or something else to cover their head instead."

Klein told the dpa news agency that his statement had been "provocative" and he "wanted to initiate a debate about the safety of the Jewish community in our country."

"Of course I believe that there must not be no-go areas anywhere in Germany for Jews or members of other minorities," he said.

CLICK HERE FOR THE FOX NEWS APP

But some were sharply critical of his statement.

Michel Friedman, a former deputy leader of Germany's main Jewish group, said it was an admission of failure and that "the state must ensure that Jews can show themselves everywhere without fear."

Bavaria's state interior minister, Joachim Herrmann, said that wearing a skullcap is part of religious freedom. "Everyone can and should wear his skullcap wherever and whenever he wants," he said.

The Associated Press contributed to this report.