He must have counted too many sheep.

A 1,300-strong flock of sheep had to be rounded up in a Spanish city after their shepherd fell asleep, The Telegraph reports.

Huge flock of sheep invades Spanish city https://t.co/5spTS3Oiq6 pic.twitter.com/6sltIezH21 — The Telegraph (@Telegraph) June 9, 2016

Police in Huesca on Tuesday morning got the unusual alert that the large flock was running around, trying to navigate the streets and causing a huge commotion.

The shepherd was supposed to be guiding the sheep past the city to hills where the animals could graze during the warm summer months, The Telegraph added.

Police found the herder – who was still dozing – and with his help were able to move the sheep away from the city.