A Sikh man who was recently ambushed, beaten up and told to return to his country said he believed that the very thing that may have prompted the assault also protected him from further harm.

“My turban really saved me,” Surjit Malhi of Turlock, Calif., said in an interview on Monday.

Mr. Malhi, 50, was putting up political campaign signs near his home, about 60 miles east of San Jose, on July 31 when, he said, two men came up behind him and accosted him. They threw sand in his eyes so he couldn’t see, he said, and struck his head and back with what appeared to be a stick and a belt.

“You don’t belong here,” he said they told him.

His truck was also vandalized. A photo posted on Facebook shows the white pickup defaced with a similar message: “Go back to your country.”

Sheriff Adam Christianson of Stanislaus County said his office was aggressively investigating the case and looking for suspects.