Shaikh Shah Wasiullah Allahabadi (Allah have mercy on him) said,
‘It is prohibited to believe that friends (awliya) of Allah are infallible. Then why should one lose conviction in them if they err. They are not flawless (ma’soom).
They can commit sins. There are many wisdoms from Allah (even) in these actions.
However, they are protected for sure. So they do not persist in their wrong doing. They immediately repent asking forgiveness from the sinful actions.
This is what I understand from ‘being protected’. That is, there should be no persistence in doing the sinful activity and (immediate) repentance is facilitated for him so that he is saved from its consequences and adverse effects.’
Ifadaat al Wasiya ala Tarse’ al Jawaher al Makkiya, page 142