In which country was the windmill invented?

In Persia around 500-900AD.