KENNEBUNK — The driver of a tractor-trailer that was carrying a load of frozen Burger King french fries was cited by Maine State Police on Sunday for distracted driving after he lost control of his truck and rolled into the median, causing a massive traffic jam on the Maine Turnpike that lasted for five hours.

State Trooper Dan Worcester said the driver, Andrew Griffin, 44, of New Brunswick, told investigators he was reaching for a bottle of water when he noticed that he had started to drift across the southbound lanes of traffic. He “overcorrected” for his mistake, causing the tractor-trailer to tip over and land on its side.

Griffin was trapped inside the vehicle at one point but was removed without injury, said Erin Courtney, the turnpike spokeswoman. The truck was hauling 3,500 cubic tons of Burger King french fries, she said.

Traffic backed up for about five miles on the Maine Turnpike near mile marker 25. The accident, which was reported at 1:30 p.m., took place just north of the Kennebunk rest area and exit.

Traffic was able to move through the crash area but it was stop-and-go for most of the way as police closed off the southbound travel lane closest to the crash. That forced motorists into the breakdown lane.

Worcester said it took several hours to unload the french fries and remove the tractor-trailer from the crash site. The scene was cleared by about 6:30 p.m.

Worcester said that Griffin works for Midland Transport Ltd., a Canadian trucking company based in Dieppe, New Brunswick.