(AP) — Denny Hamlin finally won a playoff race, a messy wreck-fest that took three overtimes Sunday and was the longest race in Talladega Superspeedway history.

Photo by Brian Lawdermilk/Getty Images

Hamlin made the winning pass on the 200th lap with a three-wide sweep coming out of the fourth turn. He dipped below the out-of-bounds line to take the lead and NASCAR needed several minutes to determine if Hamlin’s move was illegal.

The crowd of 15,000 booed Hamlin as he was declared the winner.