Our master Shaikh Ibn e Ata-Allah al Iskanderi (Allah have mercy on him) said in al Hikam,
‘Commitment of a sinful act must not make you feel hopeless in acquiring a steadfast state with your Lord. Maybe this is the last sin destined for you.’
Shaikh Mawlana Abdullah al Gangohi (Allah have mercy on him) wrote in his explanation of this;
‘This is because involvement in sinful acts due to human nature (of being weak and forgetful) is not against steadfastness on Deen. However, persisting on sinful actions, not repenting and having an intention of committing it again are against steadfastness.’
Ikmal ush Shiyam, page 55