The Prophet has been entitled the status of welayat for his infallibility and wahy-based knowledge. Given the Shia belief regarding the infallibility of the Shia Imams (free from mistake, inaccuracy and divine knowledge) entitling them with welayat due to their knowledge and infallibility is reasonable. Now in this context, how is it possible for a person to be accredited with Welayat Faqih when he isn’t infallible and as knowledgeable as the Imams nor is he protected from mistake! How is it acceptable to give someone who doesn’t possess any qualities such as infallibility and wahy the authority of God, His Prophet and Imams? He has not been chosen by an Infallible Imam nor is he safe from mistake!
What is intended by the welayat of a just faqih being the welayat of the prophets is the aspect of political welayat (meaning the government and management of the affairs of the people) which is part of welayat tashri’i (legal leadership). But welayat takwini (authority over creation and the natural world, also known as the ‘great’ wilayah) is confined to the infallible imams that carry divinely inspired knowledge and infallibility.
The primary criteria for political welayat are justice and fiqahat (jurisdiction). Therefore, not only is allotting political welayat to a just faqih by the imams not irrational, it is the most reasonable choice the Imams could have made.
There are two different welayats: A. welayat takwini, B. welayat tashri’i. According to arguments of tawhid both welayats belong to Allah Almighty.
A. Takwini Welayat: Based on Quranic teachings Allah is capable of interfering in and arranging anything as He wishes. This is what is referred to as the ‘creation’ and ‘takwini guidance’ of His creations, which is also conducted by the complete man (God’s proof) whether alive or not. This is the welayat acknowledged for Imam Asr (aj) and furthermore his absence in the time of occultation doesn’t change this situation; thus welayat takwini isn’t something the wali faqih possesses.
B. Welayat Tashri’i: This type of welayat is understood from the set of ayahs that associates Allah with the authority of tashri’ (legislating), guidance, tawfiq and the like. This welayat includes the management of worldly matters in the manifestation of government; that is that the wali accepts to manage and oversee the religious and material affairs of the people (whether this task ends with the people coming on board and establishing the Islamic government or not). In the time of occultation of the infallible Imam (as) this duty has been put on the shoulders of a just faqih and in reality, welayat faqih is the continuance of a the welayat of the Imams. The relation between these two has legitimized the leadership and actions of a competent and qualified faqih, because every legitimate government must be divinely assigned directly or indirectly and this is an essential point to be noted.
Thus, in the time of the occultation of an infallible Imam, the welayat tashri’i of God must be given to a just faqih – meaning the closest and most similar person to the infallible Imam – the wali faqih must bear the highest level of justice and although he isn’t infallible, it is the best replacement and on top of that the Islamic hakem (ruler) must be a faqih (that is he must be an expert in Islamic matters and a mujtahid) to be the proper replacement for divine knowledge. This is why it has been said that: In the time of occultation, when the Imam is absent part of his duties are delegated to his general representative and the welayat of the faqih is the continuance of the welayat of the Imams and prophets and is equal to their political welayat.
From all of the above, it can be deduced that what actually bears welayat and authority, is fiqahah (jurisprudence) and Idalah (justice), not the faqih himself; specifically speaking the faqih doesn’t have any welayat at all, it is the characteristic of fiqahat and justice that give him this authority and this welayat has been handed over to him as the Imam’s general representative. If any of the vital circumstances stated do not exist, he will not have any welayat.
Therefore just like you stated, Allah’s pledge will not be given to the wrong doers. Based on this, the most prominent condition for the Islamic ruler in the time of occultation – when infallibility isn’t an option - is idalah (justice). However the wrongdoing and mistake or even crime of another person within the Islamic government has nothing to do with the just wali faqih. The moment the wali faqih was informed of the inconvenient situation at the Kahrizak prison, he demanded it be shut down. This scenario - where some of their executives would make mistakes or commit crimes - took place in the time of the great Prophet and Imam Ali (as) as well! Although, it is noteworthy that accusing the Islamic government of untrue claims, claims that are most probably untrue and accusing them of harassment for political interests is completely wrong and inappropriate. Abstaining from mentioning these things, especially since there isn’t any particular evidence about it, is the best choice. Imam Ali (as) says: “اخوک دینُک فَاحْتَطْ لِدینک “Your religion is your brother, so practice precaution for your religion.”
 Adopted from Question 2868 (website: 5199).
 See: Imam Khomeini, Sahifeye Imam, vol. 19, pg. 403, The Institute for Compilation and Publication of the Works of Imam Khomeni, fourth print, Tehran, 1386.
 General representation means that in the ahadith, the characteristics of the representative are listed, but a specific person hasn’t been designated. See: Jawadi Amoli, Abdullah, Wilayah Faqih, pp. 178-184, Isra’ Publications, first print, Qom, 1378; Waezi, Ahmad, Hukumate Eslami, pp. 148-164, Center of Management of the Islamic Seminary in Qom, second print, Qom, 1381; Ma’rifat, Muhammad Hadi, Wilayah Faqih, pp. 122-129, Al-Tamhid Publications, second print, Qom, 1377.
 Imam Khomeini, Sahifeye Imam¸vol. 11, pg. 306; vol. 10, pg. 352.
 Sheikh Hurr Ameli, Wasa’el al-Shia, vol. 27, pg. 167, Aal al-Bayt Institute, Qom, 1409 ah.