When a minor for whom a guardian has been appointed under the provisions of this chapter or other laws of this state shall have attained his or her majority, and if incompetent shall be declared competent by the bureau and the court, and when any incompetent ward, not a minor, shall be declared competent by said bureau and the court, the guardian shall, upon making a satisfactory accounting, be discharged upon a petition filed for that purpose.