§ 25. Sale or exchange of real property owned by the state and devoted to the use of the organized militia. Upon the filing with the commissioner of general services by the adjutant general of his certificate in writing of his determination that certain real property owned by the state and devoted to the use of the organized militia of the state is no longer needed or adapted for such use and consenting that the same be sold or exchanged by the commissioner pursuant to the provisions of this section, the commission, if such certificate and consent be approved by the director of the budget and be accompanied by, annexed to, or endorsed upon an accurate map and description of such real property, may sell or exchange such real property in accordance with and subject to the terms, if any, of such consent. All sales of any such property shall be in accordance with the procedure specified in article three of this chapter for the sale of unappropriated state lands. Upon compliance by the purchaser with the terms of sale, or, in the case of an exchange of lands, with the terms of the order of the commissioner authorizing such exchange, the sale or exchange shall be consummated by the issuance of letters patent granting the state-owned real property. All moneys constituting the proceeds of any such disposition of such state-owned real property shall be paid, less any refunds made pursuant to the provisions of section twenty-six of this law, first to repay any expenditures made by the office of general services from moneys appropriated to said office in the first instance for the administration, management, utilization and disposition of real property of the state and any rights or interests therein, and any balance of such moneys remaining after repayment of the first instance expenditures shall be paid into the state treasury through the office of general services to the credit of the capital projects fund established by section ninety-three of the state finance law.