But his clarifications did not stop a wave of criticism when his appointment was announced.

Zehava Galon, the leader of the Left-wing Meretz party, said he was “unfit to be the top rabbinical authority of the IDF”. “His horrible, racist and violent statements make women a target,” she said.

Several women’s groups also objected to his promotion.

A spokesman for the IDF said: “Colonel Karim wishes to emphasise the fact that the comment made by him was purely in response to an interpretive question, and in no way whatsoever in response to a practical religious question.

“Rabbi Karim has never written, said or even thought that an IDF soldier may, under any circumstances, sexually harm women, even in times of war - the person interpreting what was said was not only wrong but also misleading.”

Rabbi Karim’s comments about rape are not the only ones to stir controversy.

He also suggested that women should not be drafted into the army except when Israel faced an existential threat, as it did during the 1948 war with its Arab neighbours.

“Because the damage to modesty that is liable to be caused to girls and the nation is critical, the sages of our generation and the chief rabbinate have ruled that drafting girls into the IDF is absolutely forbidden,” he wrote, according to the Yedioth Ahronoth newspaper.