I'm not saying that Turkey was ready for membership back then, but it became pretty clear that it wasn't a lack of democracy or poverty that was the main hinderance of turkish membership: there were just too many EU countries (and you only need one) that Turkey just had an inacceptable ratio of churches to mosques.
Around election-time EU leaders would conveniently drop most pretenses and admit to this more or less in the open.
For Erdogan, who was achieving ever more success at home, every EU visit became a humiliation. Pretty soon, he turned his back on Europe.