The opinion of the court was delivered by
Dawson, J.:This is an appeal from a judgment denying a writ of mandamus to restore a crossing on a public highway over defendant’s railway in Miami county.
The highway is a long-established township road running east and west across the county about two miles south of Spring Hill. Defendant’s railway thereabout comes up from the south toward Spring Hill, almost at right angles to the public road. From the time the railway was first constructed, in 1869, a grade crossing was maintained at the railroad and highway intersection until 1922, at which time traffic demands required the defendant to double its tracks between Paola and Kansas City, the new track being laid on the east about 36 feet from the old track. The new track is used for defendant’s northbound trains and the old track for those southbound. For economy of operation and other engineering reasons the grade of the new track was raised nine feet above that of the original track at the grade crossing. This effectually obstructed the public highway, but in lieu thereof and in accordance with plans approved by the state highway commission, defendant constructed an underpass at its own expense at the next section-line road, a mile south of the old crossing, and a new grade crossing on the next section line to the north. It also constructed about a mile and a quarter of public road on the east side of its railway, and about a quarter of a mile of road on the west side paralleling its railway,' so as to furnish the public with convenient facilities for cross-country travel in that locality.
The destruction of. the grade crossing now sought to be restored was one of several changes in railway crossings made in that locality, in conformity with an order of the state highway commission; but the validity of that order is questioned by the state. The order was made by the state highway commission after the railway’s ap*435plication for such an order had been made to the board of county commissioners and denied. Following that refusal an application was made to the highway commission, and after notice and a hearing the commission ordered this public road crossing and three others to be eliminated and two other grade crossings and an underpass to be constructed, all in a space of about two miles of defendant’s railway lines in that neighborhood.
These changes and improvements were made in 1922. This action to restore the crossing was commenced three years later. On issues joined, and on the pleadings, stipulated facts, and evidence adduced by the parties, the trial court declined to order the crossing restored, and gave judgment for defendant.
The state appeals, but there is no material controversy over the facts, the matters especially urged upon our attention being the state highway commission’s want of power to deal with township roads and the duty of the railway company to refrain from obstructing public highways.
The order of the state highway commission eliminating the crossing in question (and other crossings) and directing the establishment of certain other grade crossings and the construction of a concrete subway and approaches in lieu thereof, according to the recitals of the order, was made on authority of section 5 of chapter 245 of the Laws of 1919 (R. S. 68-509). Appellant insists, however, that this statute confers no authority on the state highway commission to eliminate grade crossings over railroads. And this contention is measurably correct, for the section begins with the imposition of that duty on the county engineer and board of county commissioners. The elimination of grade crossings has to be one of their major considerations when they are designating the county road system. But pertinent duties and powers are likewise conferred on the state highway commission, as the text of the same section proceeds:
“ . . . When the elimination, protection or improvement of a railway grade crossing, as finally determined ... by the state highway commission, shall require the relocation, laying out, altering, widening or vacating of a highway, the board of county commissioners ... by order . . . shall cause the highway to be relocated . . . altered . . . vacated,” etc.
The excerpt just quoted implies that there must be practical cooperation of the county and state boards in this matter of eliminating railway grade crossings, the county board having the initiative on proposed changes and eliminations, but to be effective these *436proposals require the assent of the state commission as to their necessity. That the matter is still within the general control of the county board, however, is manifest from later provisions of the same section of the statute:
“The board of county commissioners by its order placed of record upon its journal shall determine the nature of the changes required in such road.”
Appellant insists that whatever powers or duties the state highway commission may have concerning county (and federal-aid) roads, it has no power over township roads, and R. S. 68-404 is cited in support of that point. That section declares that the supervision of the commission shall not extend to township roads. However, continuing our perusal of the section we have been quoting from, we find the following:
“If lands are appropriated for the relocation of any county or tovmship road, which relocation is deemed necessary to avoid one or more railroad crossings or other dangerous places, the railroad company shall pay such part of the cost thereof, not less than one-half nor more than three-fourths, as is determined by the state highway commission: Provided, that said part of the cost shall be paid by the railroad company to the county and shall be used to reimburse the funds from "which the cost of land and damages were paid. The state highway commission, upon the request of any county or tovmship board, may require suitable safety devices or warning signals at dangerous or obscure railroad crossings to indicate the approach of trains, which shall be installed and maintained by the railroad company; and the state highway commission may require the removal of spoil banks and other obstructions to view, and the grading of approaches to the tracks; the cost of which shall be borne by the railroad company and county or tovmship jointly or severally in the proportions determined by the state highway commission. The state highway commission may require the construction of suitable warning signs at a dis-. tance of 200 to 300 feet on both sides of all railroad grade crossings, provided the same, in the judgment of the commission, are necessary for the safety of travel, all such warning signs on tovmship roads to be erected by the townships and those on the county roads by the county.”
It would seem, therefore, that while ordinary matters of supervision over township roads are not the official concern of the state highway commission, yet on the important matter of eliminating grade crossings over railways and the construction of undergrade and overhead crossings and similar undertakings, when the safety of the public traveling by rail and by road is the paramount concern, the state highway commission has to be consulted; and where eliminations or alterations of railway grade crossings are contemplated by the board of county commissioners, a determination of the *437state highway commission that such eliminations or alterations are a necessity is also required. So reads the statute.
This power of initiative to eliminate grade crossings, which is vested in the county board, and the power to determine the necessity for such elimination similarly vested in the state board, apply 'to all grade crossings in the county, not merely to such crossings on county roads. And certainly the need for such supervisory power over grade crossings on township roads in some respects is more urgent than on county roads, because there are so many more of them.
We do not fail to note that it is in designating the county road system that the duty is imposed on the county engineer and county commissioners to eliminate grade crossings as far as practicable, but such eliminations are not restricted to those on county roads. Nor, as we have seen, does the statute confine its mandates to matters pertaining exclusively to county roads.
We hold, therefore, that the initiative in eliminating railway grade crossings, and the authority to cause or permit such eliminations to be made, is vested in the board of county commissioners, not in the state highway commission; but that the latter tribunal is vested with the power and duty to' determine the necessity for such elimination, so that the sanction of both these official bodies is a prerequisite to such undertaking. It follows that the order of the state highway commission to which the county commissioners had previously refused their concurrence was issued without authority and gave the railway company no legal sanction for the elimination of the crossing and the consequent obstruction of the township road.
Does this conclusion constrain us to declare that the trial court should have issued a peremptory writ of mandamus directing the company to restore this township road crossing? The crossing was eliminated in 1922. The demand for its restoration came in 1925. Meantime the defendant, at considerable expense, has provided a concrete underpass and a new grade crossing for such limited cross-country traffic as exists in that locality. At its own expense, also, it has acquired land and built public roads thereabout, on both sides of its right of way, to furnish convenient access to the new crossings. The general trend of public-road traffic thereabout is north and south, not east and west. The east- and west-bound travel is negligible. There was urgent need for the double track to serve *438the increasing railway traffic demands of defendant and another railway, its lessee, which also uses those tracks from Paola to Kansas City; and there were good engineering reasons why the new track should be elevated above the level of the old grade crossing. The contour of that location and the proximity of a stream rendered impracticable the construction of an undergrade crossing at that point, and an overhead crossing would have required the construction of unusually long approaches at such a large expense as to be quite out of reason in view of the very limited cross-country traffic. It is also rather clear that the board of county commissioners should have granted the petition of the railway company for an order eliminating the crossing. And it was merely a tactical error for the railway company to go over the head of the county board to the state highway commission. What the railway company should have done was to have invoked mandamus to compel the county board to grant the order for the elimination of the crossing. (State, ex rel., v. Postal Telegraph Co., 96 Kan. 298, 150 Pac. 544.)
On the other hand, while laches and estoppel do not apply against the state, if a considerable public interest was threatened by. the raising of the railway grade, with its obvious consequence of obstructing the grade crossing on that township road, injunction would readily have halted the project unless or until the proper official sanction had been obtained by the railway company for the elimination of the crossing. Now, however, the question before us reduces to this: Can we say that the trial court erred in refusing to compel the restoration of the crossing merely because the correct legal steps to have it eliminated were not followed? Mandamus is a discretionary writ. It does not issue as a matter of strict right. The court is bound to look beyond the narrow limits to which the party demanding the writ would confine the inquiry, and consider the larger public interest which so frequently intrudes in this class of cases. The railway company irregularly has done what ought to have been regularly accomplished. But it will hardly do to say that the crossing must be restored ad interim, when it is rather obvious that the railway company could compel the county board to give its sanction to its reelimination. (State, ex rel., v. Postal Telegraph Co., supra.) The court cannot disregard the fact that the expeditious movement of railway traffic is a matter of vital public interest, and there is no practical way to reconstruct this particular grade crossing without *439demolition of the railway embankment which, of course, would completely disrupt the double-track railway service furnished to the public by two railroad companies, this defendant and its lessee.
We have some analogous precedents for dealing with such a situation. In State, ex rel., v. Telephone Co., 102 Kan. 318, 170 Pac. 26, a telephone company dismantled some 14 miles of telephone wires between Garnett and Lone Elm without first having obtained leave of the public utilities commission to do so. Mandamus was sought to compel the restoration of the telephone line, not because the public was inadequately served by other wires of the company, but merely because it had violated the law in discontinuing its former practices without obtaining the consent of the commission. The writ was denied. The court said:
“In mandamus to require a public utility to reestablish a service or practice which it has discontinued without the consent of the utilities commission, no inquiry will ordinarily be made into the question whether such service or practice is one which the utility should be or could be compelled to maintain permanently, that being a question to be passed upon in the first instance by the commission; but where the utility has already, in a proceeding before the commission to which it was made a party, shown to that tribunal the existence of facts that would have compelled the granting of such consent if it had been asked, obedience to an order of the commission directing the restoration of the service will not be compelled by mandamus, merely because of the failure of the utility to procure such consent in advance.” (Syl. (f 2.)
A principle which runs through all our cases where mandamus has been invoked to require a public service corporation to perform some corporate duty is well stated in City of Potwin Place v. Topeka Rly. Co., 51 Kan. 609, 33 Pac. 309:
“The granting of a writ of mandamus rests largely in the sound discretion of the court, and where it is asked to enforce the performance of a duty to the public, the interests of all the people concerned will be regarded, and the writ will be so framed as will best preserve and enforce the rights of all parties.” (Syl. 113.)
In Great Western Railway Co. v. The Queen, 1 El. & Bl. (Q. B.) 874, 878, it was said: “There is a very great difference between an indictment for not fulfilling a public duty, and a mandamus commanding the party liable to fulfill it.”
See, also, State, ex rel., v. D. C. M. & T. Rly. Co., 53 Kan. 329, 36 Pac. 755; Kolster v. Gas Co., 106 Kan. 84, 186 Pac. 738; Northern Pacific Railroad v. Derstin, 142 U. S. 492, 35 L. Ed. 1092.
*440In State, ex rel., v. Telegraph Co., 117 Kan. 651, 232 Pac. 1028, a railway company and a telegraph company discontinued an unprofitable telegraph service without first obtaining the assent of the public utilities commission thereto. Mandamus was invoked to compel its restoration. In denying the writ prayed for by the state, this court, speaking by its chief justice, said:
“Although the writ asked will not be issued, we have concluded that the costs of this proceeding should be paid by the defendants. Their disregard of a specific provision of the law in the discontinuance of the service without obtaining the permission of the commission warrants the court in imposing the costs upon the defendants. The judgment will be that the peremptory 'writ will not be issued, but the costs of the proceeding will be taxed to defendants.” (p. 656.)
The same rule should be applied here. The elimination of the grade crossing should not have been undertaken without an order of the board of county commissioners to that effect; but as a consideration of the larger public interest would not warrant a restoration of the grade crossing the judgment of the district court denying the writ will be affirmed; but the costs of this appeal will be taxed to the defendant.
It is so ordered.