If only a portion of the territory encompassing a sewerage disposal system and plant or plants constructed, improved, or extended by a county pursuant to the County Industrial Sewer Construction Act is annexed by a city or village, the county acting through the county board and the city or village acting through its governing body may agree between themselves as to the equitable division of the assets, liabilities, maintenance, or other obligations of the county so as to exclude the jurisdiction of the county over the portion of the system within the boundaries of the city or village, may agree to the merger of the entire system with the city or village despite the fact that some portion of the system is not within the boundaries of the city or village, or may agree that the county shall continue to own and operate the entire system despite the annexation by the city or village of a portion of the system. If a merger is agreed upon, the city or village shall have all the rights, privileges, duties, and obligations as provided in sections 23-3626 and 23-3627 when the city or village annexes the entire territory encompassing the sewerage disposal system and plant or plants and the county shall be relieved of all further duties and liabilities as provided in the agreement between the city or village and the county. No agreement between the county and the city or village shall be effective until submitted to and approved by the district court of the county in which the system or plant is located. No agreement shall be approved which may prejudice the rights of any bondholder or creditor of the county with regard to the sewerage disposal system and plant or plants. The court may authorize or direct amendments to the agreement before approving the same. If the county and the city or village do not agree upon the proper adjustment of all matters growing out of the annexation of the sewerage disposal system and plant or plants, the annexing city or village or the county may apply to the district court for an adjustment of all matters growing out of or in any way connected with the annexation of a portion of the sewerage disposal system and plant or plants and, after a hearing thereon, the court may enter an order or decree fixing the rights, duties, and obligations of the parties. Only the county and the city or village shall be necessary parties to such an action. The decree, when entered, shall be binding on all parties the same as though the parties had voluntarily agreed thereto.