In the trial of any such case, the district court having jurisdiction thereof shall make such orders, rulings and awards as shall appear just, necessary and proper, and may enjoin the completion, further construction or further use of any such dam or other designated works, if the public welfare or noncompliance with any provision of the statutes of the state shall require it, and may compel such alteration therein and in the method of constructing the same as shall be in accordance with law and necessary to the safety and welfare of any and all parties concerned, and if such proceeding shall prove to have been necessary or expedient, and in furtherance of justice, the costs thereof shall be adjudged against the defendant; but if such proceeding shall prove to have been groundless and without justification, then the costs thereof shall be taxed against the person at whose instance said action was brought.
K.S.A. 42-3,106