See verse 18. David saw his control of the situation slipping then God rose up and won the victory. God works to a pattern with His Word so we will learn to really put our faith in it.
Yes, and I am trusting in this:
20Can wicked rulers be allied with you,
those who contrive mischief by statute?
21They band together against the life of the righteous,
and condemn the innocent to death.
22But the Lord has become my stronghold,
and my God the rock of my refuge.
23He will repay them for their iniquity
and wipe them out for their wickedness;
the Lord our God will wipe them out.