It’s difficult to pinpoint when Sen. Bill Ferguson’s frustration with inequality in schools became the driving force of his professional life.

But a good place to start would be 2005, inside his Teach for America classroom in Baltimore, the room with a broken doorknob.

Fixing it was a low priority at impoverished Southwestern High School, so Ferguson carried scissors in his front pocket for two years so he could break into and out of his classroom.

“I ruined a lot of pants,” he said. “It also radically changed how I think about the world.”

Ferguson, now 36, is poised to ascend to one of the three most powerful posts in Annapolis in January, taking the helm of the Maryland Senate just as the legislature debates sweeping changes to the state’s public schools. He was unanimously endorsed by his Democratic colleagues in October to succeed Senate President Thomas V. Mike Miller Jr., which means he is assured of election to the post when the legislature convenes in January.

A mild-mannered wonk, Ferguson was a surprise choice to replace Miller, a charismatic titan ending his unparalleled 33-year reign amid a battle with cancer. Ferguson’s rise was fueled by the same principles that turned a young, right-leaning economics major into a liberal crusader — he politely listens, gathers data, then follows his moral compass.

“Mike Miller was a genius. He would know how a political campaign was going to go before it started,” said Sen. J.B. Jennings (R-Harford) , the minority leader in the Senate, where Democrats have a supermajority. “Bill doesn’t think like that. He thinks: Is this a good, or is that bad?”

As Senate president, Ferguson’s first big test will be shepherding education legislation known as the Kirwan Commission recommendations, designed to transform Maryland public schools into some of the best in the world — at an eventual price tag of $4 billion a year.

Republican Gov. Larry Hogan has denounced the proposals as too expensive, while Ferguson and new House Speaker Adrienne A. Jones (D-Baltimore County) say the state must do a better job of educating children to compete in the global economy.

“Economic opportunity is the fundamental building block of stability,” Ferguson said. “Our education system, as it exists today, is not meeting the demands of what our current and future workforce requires.”

Ferguson grew up in Montgomery County, the only child of what he described as a loving couple who were political opposites. His father worked in commercial real estate; his mother worked with labor organizers, and she made little “Billy” quiz her on the names of the presidents of all the local union chapters.

He earned pocket money filling tanks at the Adelphi gas station his family had owned for generations.

During the Clinton administration, Ferguson recalled, the family dinner table was home to passionate disagreement. His father thought Bill Clinton was terrible for business. His mother thought the president was “the greatest thing since the next coming.”

“It’s proof that people can have different politics and still love each other at the end of the day,” Ferguson said.

He majored in political science and economics at Davidson College in North Carolina, intent on a career in business or finance. He believed, he says, in the rationality of markets, the logic of supply and demand, and was “at the time, more of my father’s son.”

Then, as a dorm counselor in his junior year, he saw how many freshmen lacked support systems like the ones he had growing up.

When a friend and Teach for America alum came to campus to recruit for the program, which sends recent college graduates to spend two years in some of the country’s toughest school districts, Ferguson learned about educational disparity data that boggled his mind.

“Where somebody grows up can be the single greatest determinant of their life outcome,” he said.

He had believed that markets worked because they were rational, “but all of that assumes that people have access to perfect information,” he explained recently. If people’s high school educations are “so different based on geography — and, too often, race — then our system is totally flawed.”

Ferguson signed up to teach in the program and told his skeptical father that he wasn’t going into banking after all. He recalled that his father responded, “Okay, we’ll see you in a couple months.” But months later, he was still in that classroom in Baltimore, wrestling with that mangled doorknob.

“That really forced me to rethink a lot about what I believed in the world, what I thought was important,” he said. “I saw it as, kind of my obligation, to use the resources and privilege that I had to do good. And just, fundamentally, I believe we could do better.”

He started agitating for change from political leaders, writing letters about the deplorable conditions at Southwestern High and offering to come lick postage stamps in exchange for a visit to see the school building.

Sheila Dixon, then the City Council president and later the mayor, wrote back immediately to hire him. Eventually, Ferguson was put in charge of creating a data-driven accountability program at the Baltimore City Public School System.

By 2010, Ferguson had a master’s degree in teaching and had graduated from law school magna cum laude. He decided to run for state Senate, representing a partially gentrified, partially impoverished district of Southeast Baltimore where he lives with his wife and two children.

In the all-important Democratic primary, he took on seven-term veteran Sen. George W. Della Jr., who had served since before Ferguson was born.

Ferguson framed the race as a referendum on whether the district should remain steeped in the old political ways or embrace the future. The contest got ugly — both sides sent attack mail — but Ferguson won with 59 percent of the vote. He was unopposed in the general election, and at age 27 became the youngest member of the chamber.

Miller dubbed him the “baby senator” and sat him in the back row.

Ferguson quickly became “a center of gravity” in the legislature, said Del. Luke H. Clippinger (D-Baltimore City). He developed a reputation as liberal but not inflexible, and unusually generous with his time and resources.

Lobbyist Hannah Powers Garagiola says that when she took business clients to meet him, she saw that Ferguson had read the bill, anticipated their concerns and developed questions to better understand their point of view — even if he ultimately didn’t agree with it.

“He studies the policy, which is a breath of fresh air,” she said.

When Cory V. McCray told Ferguson he wanted to run for office, Ferguson said he needed a plan to persuade donors and community leaders to back a first-time candidate. Then he handed McCray the 12-page blueprint he had written to convince people that he should take on Della.

“He shared what most people won’t share,” said McCray, now a Democratic state senator representing Baltimore City.

Outside the legislature, Ferguson became director of reform initiatives at Johns Hopkins University’s School of Education, where he had earned a master’s degree.

He didn’t raise his hand to succeed Miller when the state Senate president signaled it was time to relinquish the gavel. The four older senators who did quickly deadlocked in a behind-the-scenes race, and the situation threatened to become an acrimonious public showdown.

A veteran Democrat from Baltimore County, Sen. Delores G. Kelley, told Ferguson he was the only one who could break the impasse. He eventually agreed to step forward but only after traveling the state to meet with colleagues to make sure they were on board.

He’s expected to receive support from the Senate’s Republican minority, as well. Jennings, the minority leader, said Ferguson is the only senator besides Miller who has requested an audience with Republicans in recent years to brief them on a policy he hoped they would support.

“George Della is probably the only guy who doesn’t like him,” Jennings said, referring to the lawmaker Ferguson ousted nine years ago.

“No comment,” Della said in a brief interview. “I don’t know anything about him.”

In a recent interview, Ferguson considered what the Teach for America version of himself might have said about becoming Senate president at the same time Maryland was about undertake the largest effort in a generation to overhaul public school education.

“At the end of the day, if we focus on the fundamental point that every child deserves true access to maximizing his or her potential, we will make the right choices,” he offered.

Then, he added: “A 22-year-old would also say, ‘Don’t blow this.’ ”