FALMOUTH, Maine (AP) — Police say two trains narrowly missed a stolen front-end loader that was being operated on and near railroad tracks outside of Portland, Maine.

Falmouth police say the first train was Amtrak's Downeaster and the second was a freight train that made an emergency stop. Train traffic was halted Saturday morning so the tracks could be inspected for damage.

Police charged 45-year-old Charles Ayres of Portland with felony theft by unauthorized use of a vehicle, aggravated criminal mischief and driving to endanger. They say they found him Saturday morning sitting in the front-end loader on tracks in west Falmouth.

Police said Ayres was uncooperative and didn't say why he stole the front-end loader. He remained jailed on Sunday, and it was unclear if he had a lawyer.