BOSTON — When veteran lawmaker Stan Rosenberg takes the gavel as president of the state Senate, he will claim several firsts.

The Amherst Democrat, expected to be formally elected by his colleagues in January, will be the first openly gay leader of a legislative chamber in Massachusetts, and the first Jewish one as well. He’ll also be the first leader in more than four decades to hail from western Massachusetts, where residents have long complained of being shortchanged by a political establishment more beholden to the larger population centers in the east.

Soft spoken, frequently self-deprecating and respected by fellow lawmakers of both parties, the 65-year-old Rosenberg has quietly cemented a reputation as a consensus builder who prefers compromise over confrontation and long-term policy solutions over quick legislative fixes.

“It isn’t about me. It’s about us,” Rosenberg said from his Statehouse office.

Rosenberg, the current Senate majority leader and the longest-serving member of the upper chamber, has repeatedly been tapped to lead delicate negotiations on hot-button topics including gay marriage, congressional redistricting and casino gambling.

His faith in government stems from his own life experiences, including a challenging childhood.

“I grew up in foster care. I went to public schools. I got my degree from a public university, and I’m serving all these years now as a public official,” Rosenberg said. “So my whole frame of reference and experience in life has been seeing the world through the investments people make in government.”

Inspired by friends from Orthodox Jewish families, Rosenberg once hoped to become a rabbi, a dream that ended when his application to Yeshiva University was not accepted. He then pursued a second love – music – at the University of Massachusetts-Amherst, which didn’t work out either.

Rosenberg eventually earned a degree in community development and arts management and worked at UMass for several years before volunteering with U.S. Sen. Edward Kennedy’s 1980 presidential campaign.

In 1986, after serving as an aide to then-state Sen. John Olver, Rosenberg won a seat in the Massachusetts House from his solidly Democratic Pioneer Valley district. In 1991, he was elected to the Senate after Olver won a special election for the U.S. House.

As chairman of the Elections Laws committee, Rosenberg convinced an initially skeptical Senate President William Bulger of the need to reform the state’s campaign finance and voter registration laws. He later chaired the budget-writing Senate Ways and Means Committee, a position that put him in frequent contact with Charlie Baker, then state secretary of administration and finance.

Rosenberg foresees a solid working relationship with Baker, now the incoming Republican governor.

“We’re both policy wonks to a certain degree,” he said. “We basically can disagree without being disagreeable.”

Rosenberg had not yet revealed publicly he was gay when, in 2003, the Massachusetts’ highest court made the state the first where same-sex couples could legally marry. He quickly became a leader in the successful effort to ward off a constitutional amendment that threatened to undo the court ruling.

“It was kind of awkward during that period to be one of the leaders in the debate and not be out,” Rosenberg recalled.

He came out several years later in typically low-key fashion. His own fear and anticipation over how colleagues and constituents might take the news was more difficult than the actual reaction.

“It was totally muted,” he said. “It was like, ‘so?’ ”

Rosenberg is not married but lives with his partner, Bryon Hefner.

Rosenberg will succeed retiring Senate President Therese Murray, a Plymouth Democrat who was the first woman to lead a legislative branch in the state. He is widely viewed as more liberal on many issues than past Senate leaders, but even Republicans like Senate minority leader Bruce Tarr respect Rosenberg’s methodical approach.

“He’s someone who is very careful and spends a lot of time reasoning through issues,” said Tarr, adding that Rosenberg has shown a willingness to provide a voice to all members, regardless of party affiliation.

Sen. Jamie Eldridge, D-Acton, noted that Rosenberg won support from more conservative Democrats along with progressives in his bid for the presidency.

“A lot of that is that he is seen as someone who is fair,” Eldridge said, and a “long-term strategic thinker.”