FORMER CONGRESSMAN Michael Capuano paid tribute to Gov. Charlie Baker on Monday at an event marking the launch of service on the Green Line extension to Somerville — and the lifelong Democrat revealed that he voted for the Republican in 2014.

Capuano said he got his chance to secure $1 billion in federal funding for the Green Line extension in 2006, when Democrats took control of the House of Representatives and put him in a position of power.

Capuano said former governor Deval Patrick and the Federal Transit Administration were key partners in that effort, but the real test for the project came in 2015 when the project budget ballooned from $2 billion to more than $3 billion. Baker was in office at the time, having defeated former attorney general Martha Coakley.

“A lot of people [in Somerville] didn’t vote for Charlie,” Capuano said.

Behind him, Baker shouted out, “A lot — like almost all of them.” (The actual vote totals in Somerville were 16,351 votes, or 72.8 percent, for Coakley, and 4,918 votes, or 21.8 percent, for Baker.)

“And you know what?” said Capuano. “Today, as a lifelong Democrat, I can look you in the eye and for the first time say that I did vote for Charlie Baker. I voted for him because I’ve known him a long time.” Capuano referred to Baker as a “long-term friend.”

Capuano said the Baker administration pushed ahead with the project and pared the cost back to $2.3 billion even though there was little political benefit for the governor.

“There is no political reason in the world that Charlie Baker should have kept this project online,” Capuano said. “It was over budget. It was still tenuous. He knew that by doing this it would not get him many votes. But I tell you I’ve known him. Charlie Baker doesn’t make decisions like that. His decisions are based on what he thinks is right or what he thinks is going to work.”

“Remember, the federal government put up a billion dollars and yes, that’s a lot of money, but so did the state. They gave a billion dollars,” Capuano said. “Politically that state billion dollars would have probably paid much bigger dividends if he put it someplace else. And he didn’t.

“To me that’s political courage, that’s political leadership and it deserves to be recognized because it’s so easy to do the easy things,” he said.

Although critics are already condemning the gentrification that is likely to accompany the opening of the Green Line extension, Capuano pointed out that the new subway trolley service isn’t tearing the community apart. He noted McGrath Highway displaced 10,000 people when it was built in the 1950s and I-93 displaced several thousand more. “People forget that,” he said.

Capuano said the Green Line extension, which opened the leg to Union Square in Somerville on Monday and will open the branch to Medford this summer, is recognition that urban areas and equity still matter in Massachusetts.

Capuano, who turned 70 this year, served in Congress from 1999 to 2019. He was defeated in the Democratic primary in 2018 by Ayanna Pressley.