SB 8.20.1

śrī-śuka uvāca
balir evaṁ gṛha-patiḥ
 kulācāryeṇa bhāṣitaḥ
tūṣṇīṁ bhūtvā kṣaṇaṁ rājann
 uvācāvahito gurum
Word for word: 
śrī-śukaḥ uvāca — Śrī Śukadeva Gosvāmī said; baliḥ — Bali Mahārāja; evam — thus; gṛha-patiḥ — the master of the household affairs, although guided by the priests; kula-ācāryeṇa — by the family ācārya or guide; bhāṣitaḥ — being thus addressed; tūṣṇīm — silent; bhūtvā — becoming; kṣaṇam — for a moment; rājan — O King (Mahārāja Parīkṣit); uvāca — said; avahitaḥ — after full deliberation; gurum — unto his spiritual master.
Translation: 
Śrī Śukadeva Gosvāmī said: O King Parīkṣit, when Bali Mahārāja was thus advised by his spiritual master, Śukrācārya, his family priest, he remained silent for some time, and then, after full deliberation, he replied to his spiritual master as follows.
Purport: 

Śrīla Viśvanātha Cakravartī Ṭhākura remarks that Bali Mahārāja remained silent at a critical point. How could he disobey the instruction of Śukrācārya, his spiritual master? It is the duty of such a sober personality as Bali Mahārāja to abide by the orders of his spiritual master immediately, as his spiritual master had advised. But Bali Mahārāja also considered that Śukrācārya was no longer to be accepted as a spiritual master, for he had deviated from the duty of a spiritual master. According to śāstra, the duty of the guru is to take the disciple back home, back to Godhead. If he is unable to do so and instead hinders the disciple in going back to Godhead, he should not be a guru. Gurur na sa syāt (Bhāg. 5.5.18). One should not become a guru if he cannot enable his disciple to advance in Kṛṣṇa consciousness. The goal of life is to become a devotee of Lord Kṛṣṇa so that one may be freed from the bondage of material existence (tyaktvā dehaṁ punar janma naiti mam eti so ’rjuna). The spiritual master helps the disciple attain this stage by developing Kṛṣṇa consciousness. Now Śukrācārya has advised Bali Mahārāja to deny the promise to Vāmanadeva. Under the circumstances, therefore, Bali Mahārāja thought that there would be no fault if he disobeyed the order of his spiritual master. He deliberated on this point — should he refuse to accept the advice of his spiritual master, or should he independently do everything to please the Supreme Personality of Godhead? He took some time. Therefore it is said, tūṣṇīṁ bhūtvā kṣaṇaṁ rajann uvācāvahito gurum. After deliberating on this point, he decided that Lord Viṣṇu should be pleased in all circumstances, even at the risk of ignoring the guru’s advice to the contrary.

Anyone who is supposed to be a guru but who goes against the principle of viṣṇu-bhakti cannot be accepted as guru. If one has falsely accepted such a guru, one should reject him. Such a guru is described as follows (Mahābhārata, Udyoga 179.25):

guror apy avaliptasya
 kāryākāryam ajānataḥ
utpatha-pratipannasya
 parityāgo vidhīyate

Śrīla Jīva Gosvāmī has advised that such a useless guru, a family priest acting as guru, should be given up, and that the proper, bona fide guru should be accepted.

ṣaṭ-karma-nipuṇo vipro
 mantra-tantra-viśāradaḥ
avaiṣṇavo gurur na syād
 vaiṣṇavaḥ śvapaco guruḥ

“A scholarly brāhmaṇa expert in all subjects of Vedic knowledge is unfit to become a spiritual master without being a Vaiṣṇava, but if a person born in a family of a lower caste is a Vaiṣṇava, he can become a spiritual master.” (Padma Purāṇa)