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