[44] In 1869, McKinley ran for the office of prosecuting attorney of Stark County, an office that had historically been held by Democrats, and was unexpectedly elected.[45] When McKinley ran for re-election in 1871, the Democrats nominated William A. Lynch, a prominent local lawyer, and McKinley was defeated by 143 votes.[45]
As McKinley's professional career progressed, so too did his social life blossom: he wooed Ida Saxton, the daughter of a prominent Canton family.[45] They were married on January 25, 1871, in the newly built First Presbyterian Church of Canton. Ida soon joined her husband's Methodist church.[46] Their first child, Katherine, was born on Christmas Day 1871.[46] A second daughter, Ida, followed in 1873 but died the same year.[46] McKinley's wife descended into a deep depression at her baby's death and her health, never robust, declined.[46] Two years later, Katherine died of typhoid fever. Ida never recovered from her daughters' deaths, and the McKinleys had no more children.[46] Ida McKinley developed epilepsy around the same time and depended strongly on her husband's presence.