A Canadian expatriate working in Kathmandu has been arrested and threatened with expulsion from Nepal because of his social media posts criticizing the country's human-rights situation.

Robert Penner, a software developer living in Lalitpur, a district south of Kathmandu, had been writing about issues such as the problems of the Madhesi minority, the arrest of prominent journalist Kanak Mani Dixit and the local reaction to a recent report by Human Rights Watch on Nepal.

Mr. Penner said the local police came to his office on Monday afternoon.

Story continues below advertisement

"I repeatedly asked Nepal Police to tell me under what charges they're taking me but they won't say," he tweeted just before his arrest.

Mr. Penner was being held overnight on immigration charges that his Twitter posts were harming "security and mutual harmony in Nepal," his lawyer, Dipendra Jha, told The Globe and Mail.

"They're saying they plan to deport him back because they can cancel his visa."

Rishi Ram Sharma, Chief District Officer of Lalitpur, confirmed to The Globe that local police took Mr. Penner into custody at the request of immigration officials.

"Immigration asked us to hand [him] over," he said when reached by phone.

Kedar Neupane, director-general of the Department of Immigration, declined to comment when contacted by The Globe, saying he was busy with a meeting.

Mr. Neupane, however, told the Nepalese newspaper Republica that his department wants to expel Mr. Penner back to Canada.

Story continues below advertisement

"He obtained a visa for working at an IT company but he was found engaged in making provocative statements that may jeopardize national integrity," Mr. Neupane was quoted as saying.

"Foreigners are not allowed to engage in such activities."

Madhesi activist Puru Shah said Mr. Penner had riled up many Nepalese nationalists by questioning how their country was handling human-rights concerns.

"He's a very logical guy. He sees something that is not logical, he will call it out," Mr. Shah said in an interview.

The arrest puts a spotlight on the country's controversial new Constitution, which has upset minorities such as the Madhesi, who say they will be marginalized under its citizenship rules.

Under the new Constitution, children of Nepali women who marry foreigners won't have full-fledged citizenship rights, an issue for the Madhesis, who live near India and have a tradition of cross-border marriages, Mr. Shah said.

Story continues below advertisement

He said Mr. Penner had written two articles for a pro-Madhesi website. "He made a lot of people upset."

According to his social media posts, Mr. Penner is a former Kelowna, B.C., resident who first visited Nepal a decade ago and has been living in the Kathmandu area for the past four years, working for a technology outsourcing company, CloudFactory.

"My Twitter timeline is a war zone these days," Mr. Penner told a friend on Facebook last December.

He shared screen captures of people on Twitter accusing him of having a hidden agenda and using human-rights discussions as a cover to promote "the secessionist movement."

Some made threats, others called on the Nepalese government to expel Mr. Penner.

Mr. Shah said he saw a tweet written in Nepali earlier this month that alerted an official government account about Mr. Penner's writings. The government account then replied, asking for more details, Mr. Shah said.

Story continues below advertisement

Under the new Constitution, the right to freedom of expression is only guaranteed to Nepalese citizens, not foreign residents, human-rights lawyer Santosh Sigdel told The Globe.

"That's unfortunate that Nepal has not guaranteed the right to freedom of expression and opinion to everyone despite its ratification of the [United Nations's] International Covenant on Civil and Political Rights," Mr. Sigdel said.

"It would set a very bad example if it deports someone just for expressing his views on social media."

Mr. Sigdel also noted that another Nepalese law makes it illegal to publish material in the electronic media that "may jeopardize the harmonious relations subsisting among the peoples of various castes, tribes and communities."

He said that provision was very vague and went beyond the limitations authorized by the UN covenant that Nepal had signed in 1991.