A service station in Derbyshire had to be evacuated when a man doused himself with petrol on the forecourt and threatened to set himself alight.
People living in two houses close to Woodville services on Burton Road were also led to safety while police negotiators were called.
The man handed himself in at about 0120 BST, about half an hour after the stand-off began.
He was checked by paramedics before being taken to hospital.
Nearby roads were closed and the petrol station cordoned off while the situation was dealt with.