KATHMANDU, Nepal — A Canadian man living in Nepal has two days to leave the country, the Nepalese immigration authorities said on Tuesday, after he was accused of posting a message on Twitter “aimed at spreading the social discord.”

The man, Robert Penner, was arrested on Monday at his office in the Lalitpur district, south of the capital, Kathmandu, on orders of the Department of Immigration, police and immigration officials said. He was held for a day before the department canceled his work visa and ordered him to leave the country.

The department had received a complaint against Mr. Penner for “spreading unnecessary messages about Nepal,” said Kedar Neupane, the director general of the Department of Immigration. Mr. Neupane did not say who had initiated the complaint or which of Mr. Penner’s many social media posts about Nepalese politics were found to be offensive.

“His working visa has been canceled after the charges against him were proven true,” Mr. Neupane said.