Peace be upon you. If the mental capacity is lost, the power of attorney is invalidated, and the authority to manage the funds belongs to the legal ruler or their representative in this matter. According to Ayatollah Khamenei, the power of attorney is void if either the agent or the principal becomes insane, and if the insanity is intermittent, its validity during the period of insanity is questionable, so it is advisable to exercise caution. The guardianship over the property of the insane person is with the legal ruler in the absence of a father or grandfather, as stated by Ayatollah Sistani.