The police are typically allowed to detain someone after they've committed a crime. You're technically detained during a traffic stop until after the police officer tells you you're allowed to leave. So I assume the police were well within their rights to detain him since he was walking down the middle of the street.No probable cause... .no detention or perturbation of his travel. Period full stop.
The police officer started her interaction by asking him if he was okay and if he needed a ride home. A common sense response could've prevented this entire ordeal. A lot of problems could be solved with a little bit more common sense, both by civilians and police officers.