When any fencing district in this state has completed all of the contemplated improvements and has paid and discharged all of its obligations and has a surplus of funds on hand, not needed for repair or maintenance or the operation of the district, then, in such event, the board of directors of the district may, in their discretion, contribute so much of the surplus funds as they may determine to any public, charitable, educational, or general welfare purpose within the county in which the district is situated.