One day Jesus told his disciples a story to show that they should always pray and never give up. “There was a judge in a certain city,” he said, “who neither feared God nor cared about people. A widow of that city came to him repeatedly, saying, ‘Give me justice in this dispute with my enemy.’ The judge ignored her for a while, but finally he said to himself, ‘I don’t fear God or care about people, but this woman is driving me crazy. I’m going to see that she gets justice, because she is wearing me out with her constant requests!’”
Then the Lord said, “Learn a lesson from this unjust judge. Even he rendered a just decision in the end. So don’t you think God will surely give justice to his chosen people who cry out to him day and night? Will he keep putting them off? I tell you, he will grant justice to them quickly! But when the Son of Man[a] returns, how many will he find on the earth who have faith?” – Luke 18:1-8
Jesus was obviously not likening God to the corrupt judge but rather drawing a parallel between the widow and the petitioner.