It is entirely by God's grace, not because of anything we have done.
Watch the Teaching: Why Didn't God Answer Paul's Prayer to Escape Suffering?