Hastings was a candidate for governor in
1890, but
Matthew S. Quay, leader of the state Republican Party, succeeded in obtaining the nomination for George W. Delamater, defeating Hastings by only 11 votes. As a wealthy banker affiliated with
Standard Oil, Delamater proved unpopular with many Republicans, who gave him lukewarm support or supported the
Democratic nominee, former governor
Robert E. Pattison. Pattison had been elected in
1882, and served from 1883 to 1887. Pattison was barred by law to an additional consecutive term and so could not run for reelection. James Beaver defeated Chauncey Forward Black in the
1886, and served from 1887 to 1891. Pattison running again then defeated Delamater in
1890, and served from 1891 to 1895. Hastings sought the
Republican gubernatorial again in
1894. He obtained it, and defeated the Democratic nominee,
William M. Singerly. Hastings served one term, 1895 to 1899. As governor, in
1895 Hastings appointed the first seven judges to the newly created
Pennsylvania Superior Court, including former governor Beaver. In addition, his administration included the creation of the
Pennsylvania State Game Commission,
State Forestry Commission, and
Pennsylvania Department of Agriculture. He also signed into a law a measure to replace state property taxes with a tax on corporate profits. Also in 1895, Hastings enacted the
Pennsylvania Capitol Police, the first Pennsylvania
police agency under Commonwealth jurisdiction and the second oldest state police organization in the United States, after the
Texas Rangers. In
1897, the State Capitol Building in Harrisburg was destroyed in a fire, and the Hastings administration started efforts to erect a replacement, which was completed in 1906. Hastings directed the state's response during the
Spanish–American War, working with the state legislature to raise troops, supplies and equipment and transport them to mobilization sites, and then taking steps to return soldiers to Pennsylvania and demobilize them at the end of the war. ==Death and burial==