After victory against Banu Thaqif at Hunayn, Prophet Muhammad marched his army to Ta’if, where Banu Thaqif had retreated to and barricated themselves inside with enough food and water to last them for a year.
The Prophet declared any slaves who joined Islam and left the fortress would be granted freedom, and many took him up on the offer.
As the siege extended, the prophet decided a military victory there wasn’t necessary. Thaif was isolated from all allies and would eventually realize it’s advantageous to join Islam.
Podcast version: podcast.lifeofprophetmuhammad.com