Bhagavad Gita 9.30

Chapter 9: The royal secret

अपि चेत्सुदुराचारो भजते मामनन्यभाक् ।
साधुरेव स मन्तव्यः सम्यग्व्यवसितो हि सः ॥ ३० ॥

Even if the most sinful worship Me, with undivided heart, he too must be accounted righteous, for he hath rightly resolved;

Sanskrit text and English translation: Annie Besant, The Bhagavad-Gita, 4th edition (1922) — public domain, via Wikisource. Chapter summaries: SamayaVeda.