RICHMOND — Republican Del. M. Kirkland Cox spent nearly 30 years making a methodical climb to one of the highest perches in Virginia politics.

The high school teacher and coach mastered state budget arcana, shepherded conservative bills into law and built personal relationships within the legislature — all in the understated, reserved style of the Old Dominion. To no one’s surprise, he was designated speaker-in-waiting last year as Speaker William Howell (R-Stafford) announced plans to retire from the House of Delegates.

Yet by the time Cox took hold of the gavel in January, the ground had shifted beneath his feet.

Heading into November elections, Cox’s party boasted a 66-to-34 majority in the House. An anti-Trump tsunami all but wiped it out. After weeks of recounts and court challenges in a handful of squeaker races — plus a rare lottery drawing to decide one tie — the GOP managed to hold on by two seats, 51 to 49.

It was humbling and disorienting: A man who — in the classroom, on the baseball field and in politics — left nothing to chance ultimately owed his speakership to dumb luck.

“When you have 66 seats, you think that’s a pretty definite thing,” Cox said. “Obviously you don’t expect to lose that many seats. That was really tough.”

Many Republicans are looking to Cox to salvage the GOP brand in a swing state that, even before President Trump, increasingly tilted blue. The party has not won a statewide contest since 2009.

Though he says his chief duty is to the House as an institution, Cox does not dismiss the idea of using his speakership to rebrand the GOP, whether by taking a hard line against sexual harassment, recruiting more female candidates or downplaying divisive social issues.

His legislative agenda emphasizes “practical solutions to everyday problems.” And he has highlighted areas of agreement with Gov. Ralph Northam (D), including criminal justice and regulatory reforms — dealmaking that contrasts with his mostly sour relations with former governor Terry McAuliffe (D).

The approach could show Republicans the way forward, said Frank Atkinson, author of two books on Virginia politics. “Is his MO, his brand, a way for Republicans to start winning again?” Atkinson said. “I’d answer affirmatively.”

Cox, who calls pride his “biggest weakness,” has shown some humility in his new role. Newly elected delegates, regardless of party, used to pay their respects to Cox’s predecessor by making a pilgrimage to the log cabin housing Howell’s law office. The current crop of freshmen, most of them Democrats, did not beat a similar path to Cox’s door. So Cox reached out to them.

More significantly, just weeks into the session, Cox budged on an enormous issue: After four years of steadfast opposition, he opened the door to expanding Medicaid under the Affordable Care Act.

The last anyone knew, House Republicans were never going to expand, no way, no how.

Still, his openness to expansion came with a caveat. Unless able-bodied Medicaid recipients are required to work, he warned Northam in a letter, the rolls will not expand.

Northam has greeted Cox’s position as progress. Minority Leader David J. Toscano (D-Charlottesville) also hit a note of cautious optimism.

But with recent polls showing that a majority of Virginia voters support Medicaid expansion, a blunter take came from one of the more liberal House members, Del. Marcus B. Simon (D-Fairfax).

“If they spend the next two years obstructing, they’re writing all our campaign brochures,” Simon said. “I don’t think they want that to be the rallying cry for 2019.”

Teacher, delegate, father

Marvin Kirkland Cox — he’s always gone by Kirk — grew up in the Richmond suburb of Colonial Heights. From his mother, a shorthand and typing teacher, he inherited a love of teaching. From his father, an accountant at Brown & Williamson tobacco, a devotion to the New York Yankees. And from a worldly great-uncle, a passion for politics.

The family first lived in an older home behind a bowling alley, then moved across town to a still-sprouting subdivision. The longer the surrounding construction took, the better.

“They’d clear lots, you could make that into a baseball stadium,” said Cox’s lone sibling, Joe Cox, who is three years older and superintendent of Colonial Heights schools. “The one diagonal from our house seemed to take forever. I think we played there for a year.”

Cox earned a degree in political science at James Madison University, then began a 30-year career teaching government. He took a summer job waiting tables at the Swift Creek Mill Theatre, and hit it off with the hostess, Julie Kirkendall.

“I thought he was funny, and charming, and very nice,” said Julie Cox, who was then a student at the College of William & Mary and is now a suicide crisis counselor.

Cox surprised her with a ring on her birthday in October 1984. By then he was working on Wyatt B. Durrette’s unsuccessful 1985 campaign for Virginia governor. The job, which gave Cox “the bug” to run for delegate in 1989, involved driving Durrette all around the commonwealth in a powder-blue Cadillac.

The couple planned their wedding around the campaign.

“We either had to get married in March so Kirk could get time off or wait until after the election,” said Julie, who opted for March.

Even the birth of their second child, due early one November when Cox was seeking reelection to the House, was guided by the political calendar.

“He was ready to be born. I was so tired of being pregnant, I cried in the obstetrician’s office,” she said. “They said, ‘We’ll induce. We’ll do it that Tuesday.’ Then I cried even harder because that was Election Day.”

She waited; the baby came two days after the election.

For much of his career, Cox juggled the duties of a delegate, teacher and father. A long-term substitute covered for him in the classroom during sessions. At home, Cox was still on the hook for yardwork and laundry. For 15 years, while his four boys were young, he coached Little League, with Joe as his assistant. Sometimes Cox would arrive at the ballfield straight from a meeting, with no time to change clothes.

“I got to be very good friends with the dry cleaner. ‘I know I have red dirt on the suit pants again,’ ” Julie Cox said.

Cox ran for Congress in 2001, in a special election after the death of U.S. Rep. Norman Sisisky (D). He lost the GOP nod to J. Randy Forbes. Since then, Cox has seemed content to make his mark in the House. A fiscal and social conservative who doesn’t drink or curse, he has focused on issues with bipartisan appeal, such as education and economic development.

“If I went to him — working for Tim Kaine, Bob McDonnell or Terry McAuliffe — I never was concerned that politics was going to enter the fray,” said former commerce and agriculture secretary Todd Haymore, who served the three governors — one Republican, two Democrats.

Even Toscano, while wary of Cox’s decision to route certain high-priority bills through a committee the speaker controls, said he is “usually very forthright with us.”

But some progressives are highly frustrated with Cox. He may be soft-pedaling social issues — House Republicans did not introduce a single antiabortion bill this year — but his caucus has blocked a string of Democratic priorities.

“We hoped this year would be a turning point,” James Parrish, executive director of Equality Virginia, lamented after a House subcommittee scuttled legislation Thursday to protect gay and transgender people from housing and job discrimination.

Logan Miller, a gay graduate student studying to become a government teacher, came to the Capitol to advocate for the bills. He’d visited a decade earlier, with the charismatic high school teacher who had inspired his career choice — Cox. He still sees his old teacher as a leader, but of a doomed old guard on LGBT issues.

“It’s tooth and nail to keep the status quo,” said Miller, 27. “The tide is rising, and whether they like it or not, it will be reality.”

Spiritual crisis

Before becoming speaker, Cox spent eight years as majority leader, a job that typically involves sparring with the minority leader on the floor each day. He largely delegated that duty to Del. C. Todd Gilbert (R-Shenandoah), a verbally deft former prosecutor.

The approach seemed suited to Cox’s personal reserve, which stands out in a realm where voluble backslappers are the norm. Cox is not merely taciturn. He admits to having a “fanatical” dread of embarrassment, something that drives him to prepare exhaustively to avoid mistakes. It also fed a long period of spiritual angst, which struck as he worked his way up in the House.

Cox had been raised and baptized in a Disciples of Christ church. He joined a Baptist church as an adult and began to feel that his original baptism — at age 12 as part of class — had not been heartfelt. He would listen as his preacher spoke, movingly, about giving it all up for God. He felt the Holy Spirit urging him to walk to the altar and humble himself before Christ.

But Cox would not budge.

“I might as well have been cemented to my seat,” he said. “It was as if Satan was sitting on my shoulders saying, ‘You don’t need to do that.’ It would be incredibly embarrassing — everyone would see Delegate Kirk Cox walking down the aisle. ‘Wasn’t he supposed to be saved?’ You’ll be the talk of the city.”

Cox’s discomfort only grew over the years, as he was elected deacon, then chairman of all 50 deacons. Deep down, he felt like a fraud unless he swallowed his pride and answered his pastor’s altar call.

“I am not saved,” he finally confessed a dozen years ago before 900 fellow worshipers.

The Rev. Randall T. Hahn of the Heights Baptist Church counseled Cox through the crisis and within weeks presided over his full-immersion baptism.

“That, to me, is a picture of his genuineness,” Hahn said. “It would have been easier to just not rock the boat.”

Right for this moment

Cox, who follows a speaker known for his quick wit, has a resting face that looks like a scowl. Some call it his “teacher face,” good for reining in rowdy students and legislators alike.

“There’s a quiet intensity and conscientiousness to what he’s doing,” said former governor George Allen (R). “There’s nothing really frivolous about Kirk Cox.”

That said, Cox enjoys a good joke — even if it’s on him.

“Introducing the @SpeakerCox joke counter: 00001,” Cox’s chief of staff, Matthew Moran, tweeted as the session kicked off. As week four wrapped up, the count stood at a mere 6.

Some say Cox’s more serious, regimented style is a good fit for this moment. It can be felt all the way down to the “morning hour,” once a jumble of procedural moves, pontification, and the introduction of guests in the gallery.

Since delegates sometimes zone out or wander off to the antechamber lunch buffet during the hour, they were at risk of missing critical procedural votes if those popped up without warning. So Cox has set aside a separate time for those.

“There could be a looseness about the General Assembly when it’s 66-34,” said Del. Greg Habeeb (R-Salem). “Outcomes are kind of preordained. You know where the votes are. The moment we’re in now, you need people in their seats.”