As we can see in the book of Jeremiah, even when the Lord is chastising his people for their disobedience and their evil ways.
...And in the midst of their captivity by the Babylonians ... His wondrous grace and mercy is still given unconditionally.
Jeremiah 29:11-13
11 For I know the thoughts that I think toward you, said the LORD, thoughts of peace, and not of evil, to give you an expected end.
12 Then shall you call on me, and you shall go and pray to me, and I will listen to you.
13 And you shall seek me, and find me, when you shall search for me with all your heart.
_