When Martin J. Walsh was first elected to the Massachusetts House 17 years ago, he couldn’t sleep after his victory in a hard-fought special election. So he drove to the State House at 2 a.m., and gazed up in awe at the golden-domed capitol where he would be working.

On Wednesday, he returned to that historic building not as a wide-eyed freshman legislator, but as the triumphant mayor-elect of the city of Boston.

When he walked onto the floor of the House, Republican and Democratic colleagues pulled in him for hugs, and then saluted him with speeches and standing ovations.

“I love all of you,” Walsh said in a brief speech from the House speaker’s ornate podium. “I love this institution. I’m proud to be able to say I’m a member of the Massachusetts House of Representatives.”

Get Fast Forward in your inbox:

Forget yesterday's news. Get what you need today in this early-morning email.

He said that while he was honored to be elected mayor of Boston, it would be hard to leave the House.

“I will always be supportive of this institution for as long as I’m in politics,” he said.

David L. Ryan/Globe Staff

Walsh got a round of applause, including from Speaker Robert DeLeo, inside the House of Representatives chamber.

The nearly 160 members of the House had gathered in the chamber for a debate on a welfare reform bill. But they delayed the start to pay tribute to Walsh, and to his partner of eight years, Lorrie Higgins, and her daughter, Lauren Campbell, both of whom sat at front of the chamber.

Representative Eugene O’Flaherty, a Chelsea Democrat and Higgins’ boss, fought back tears as he spoke of how happy Walsh’s late father, John, would have been to see his son elected mayor.

House Speaker Robert A. DeLeo, a Winthrop Democrat who once had a contentious relationship with Walsh but endorsed him and campaigned for him in the mayor’s race, delivered a speech in which he told Walsh, “You have tested my patience at times – many times.”

But he said Walsh showed his mettle by not backing away for his staunch support for labor unions, even when that support came under attack in the mayor’s race.

DeLeo told House members that Walsh will not resign from his position as the chairman of the House Ethics Committee until the end of the year, “so to all who wanted his chairmanship, you’re going to have to wait a while.” The coveted post carries with it a $15,000-a-year salary boost.

Walsh ended his speech with a plea to his colleagues, urging them not to prolong the debate on the welfare bill. “Let’s just speed this along today, guys,” he said. “I’m the mayor now.”

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.