Ibn Mas’ūd, may Allah be pleased with him, said:
“A person may be worried about a matter pertaining to business or leadership, until it’s made easy for him. And Allah looks at him from above the seven heavens and says to His angels: “Repel this from him. If I was to make this easy for him (to obtain), I’m going to admit him into the hellfire (because of it).” Thus, Allah diverts this matter away from him. And (as a result) he becomes pessimistic saying,” So and so beat me to it!” “So and so deceived me!” However, it is only Allah bestowing His favor upon him.
شرح أصول الإعتقاد لللالكائي ٧٤٠/٤