BANGOR, Maine — A Canadian man who had been living and working in the United States for nearly 40 years was sentenced Tuesday in U.S. District Court to time served, or three months and 22 days, for re-entering the country after being ordered removed.

John D. Fraser, who also used the name John Knight, 55, of Port St. Lucie, Florida, and Halifax, Nova Scotia, waived indictment and pleaded guilty to one count of re-entry after removal.

Fraser was expected to be turned over to immigration officials for removal proceedings.

He was arrested on Nov. 20 after he attempted to cross the border in Calais, according to a press release issued by the U.S. attorney’s office. Fraser was a passenger in a vehicle with Florida license plates driven by his wife returning from visiting his mother in Canada, according to the complaint.

After initial denials, Fraser admitted that he had been living and working in the U.S. for 38 years without authorization, the complaint said. A fingerprint check showed that Fraser had a significant criminal history including convictions for cocaine possession in 1988 and 1999.

He was ordered removed from the U.S. in 2010 but returned in June 2011 without getting authorization to do so after changing his name to Knight in Halifax, the complaint said.

Fraser had been held without bail since his arrest. He faced up two years in federal prison and a fine of up to $250,000.