The music director of Leipzig died in 1722, so the city council held an audition for his replacement. The winner was Georg Philipp Telemann. He went back to Hamburg, where he worked, and demanded a raise. They gave him the raise, so he stayed in Hamburg.
Next they tried to hire Christoph Graupner, one of the foremost composers of the day. He worked in Darmstadt, but the city wouldn't let him go. Back then you often needed permission from your employer to get a new job.
One of the Leipzig city councilors said: "Since the best men cannot be obtained, we must make do with the mediocre."
So they hired Johann Sebastian Bach.