There has certainly been for you in them an excellent pattern for anyone whose hope is in Allāh and the Last Day. And whoever turns away - then indeed, Allāh is the Free of need, the Praiseworthy.
This good example is only followed by those who have hope for good from Allah in the world and afterlife. Those who turn away from this good example, then Allah is in no need of His servants. He does not require their obedience and He is worthy of praise in every state.