“There is no specific mechanism in place that would allow a visitor to know ahead of time whether they would be let in or not,” she wrote. “The final decision on whether to allow someone to enter Canada is made by a Canadian Border Services Agency officer once the person arrives at a point of entry.”

Travelers with criminal records can apply for a rehabilitation waiver or a temporary resident permit to visit Canada, but the application requires copies of court documents that can be costly and time-consuming to collect.

For foreigners hoping to visit the United States, having a criminal record — or even publicly admitting illegal activity — can also be a barrier to entry. This spring, the British chef Nigella Lawson was prevented from visiting after she disclosed in a court case that she had used cocaine, and The Globe and Mail reported this week that Mayor Rob Ford of Toronto, who had said he would seek treatment for an alcohol problem, flew back to Canada without officially entering the United States in Chicago. Mr. Ford has also admitted using illegal drugs.

Citizens of countries in the United States’ visa waiver program — like Britain — do not need a visa for short trips but must answer questions like “Do you have a communicable disease; physical or mental disorder; or are you a drug abuser or addict?”

The questionnaire, part of the Electronic System for Travel Authorization, vets travelers and grants them permission to visit the United States. One of the questions asks potential visitors whether they have ever been arrested or convicted of a violation related to a controlled substance or an offense involving “moral turpitude” — a broad list including fraud, larceny and “the intent to harm persons or things.”

Jenny Burke, a spokeswoman for Customs and Border Protection, said that having ESTA approval or a visa does not guarantee admission to the United States and that border officers make final admissibility decisions; they refuse entry to about 366 people a day. Besides being responsible for immigration and customs laws, she said, officers enforce more than 400 laws for other agencies — creating opportunities for mistakes, some lawyers say.

“Border officers are not trained as lawyers,” said Robert Pauw, an immigration lawyer with Gibbs Houston Pauw in Seattle. “We’ve definitely seen cases where they misinterpret the law or don’t understand the law, and people suffer the consequences for that. What you need to be careful about is, if the officer does ask questions more specifically, you need to answer honestly.”