After news of Sunday's incident, Palestinians threw stones at Israeli cars driving to nearby Jewish settlements, slightly hurting one woman and sparking clashes with Israeli soldiers who fired tear gas and shot bullets into the air.
The incident is likely to raise tensions still further in the Palestinian territories, where protests have erupted over the publication in European newspapers of cartoons depicting Muhammad.
Many Muslims consider any image of Muhammad as blasphemous.
Two Palestinians were wounded in the violence, medics said.
"During the night, a group of settlers came to a mosque in the village of Nabi Ilyas and spray-painted the graffiti," the military source said. "Soldiers are removing the graffiti."
Residents said the slogan, written in red letters in Hebrew, denigrated Muhammad and said that a Star of David was also daubed on the mosque.
The defacing was also reported by Israel Radio and Israeli news websites.
Othman Zimmari, 67, said: "I open the mosque every day for dawn prayers. Today, when I went to open it, I saw a person wearing a skullcap spray-painting at the wall.
"When he saw me, he ran towards a white car with yellow [Israeli] licence plates. I could not tell if there were other people in the car. I rushed inside the mosque and locked the door because I was afraid."
A spokesman for Israeli police in the West Bank said they had opened an investigation.