OTTAWA (Reuters) - U.S. authorities are entitled to search the mobile devices of Canadians seeking to cross the border, a spokesman for Ralph Goodale, Canada’s public safety minister, said on Saturday.

Several Canadians traveling to attend Friday’s inauguration of Donald Trump as president of the United States or Saturday’s protest march in Washington were turned away at the border earlier this week. One group was held for two hours and made to unlock and hand over their mobile phones for inspection before ultimately being denied entry.

“When entering another country, including Canada, it has always been the case that goods accompanying a traveler may be searched to verify admissibility,” Scott Bardsley, the minister’s press secretary, said in an emailed statement.

“Every country is sovereign and able to make its own rules to admit people and goods to manage its immigration framework, health and safety,” he added.

Relations between Canada and the United States are under scrutiny following the election of Trump, who has vowed to put “America first” and renegotiate a trade agreement with Mexico and Canada.