"I am so proud of what we built together. I'd do it with you all again in a heartbeat," said the Massachusetts congressman after losing the Democratic primary for the Senate race
Joseph P. Kennedy III
Rep. Joe Kennedy III takes the stage before introducing Sen. Elizabeth Warren (D-MA) during her event announcing her official bid for President on February 9, 2019, in Lawrence, Massachusetts.
| Credit: Scott Eisen/Getty

Rep. Joe Kennedy III ended a streak in his family's storied Massachusetts political dynasty, falling short in his race for the Senate this week.

On Tuesday, the 39-year-old Kennedy lost the state’s Democratic primary against incumbent Rep. Edward J. Markey, 74. The Massachusetts congressman and grandson of Robert F. Kennedy (and great-nephew of former President John F. Kennedy) is the first Kennedy to lose an election in Massachusetts.

"To everyone who fought with us. Everyone who stood with us. Everyone who believed in us and gave their sweat and tears and hearts and souls to this fight: Thank you. I am so proud of what we built together," Joe tweeted on Tuesday night. "I’d do it with you all again in a heartbeat."

Joe (who was first elected to Congress in 2012) announced his bid for the Senate seat last September, telling the Associated Press that "primaries are something that people should shy away from."

“The idea behind it is that every seat, my own included, the one that I currently occupy as a member of the House of Representatives, it’s up every two years. It’s a two-year term. You have to go out and make that case to voters every two years,” he said at the time.

Never miss a story — sign up for PEOPLE's free daily newsletter to stay up-to-date on the best of what PEOPLE has to offer, from juicy celebrity news to compelling human interest stories

Markey joined the U.S. House of Representatives in 1976 and was elected to the Senate in a special election in 2013. Celebrating the win on Tuesday evening, Markey thanked the "thousands of grassroots supporters who organized around the principles that we believe in."

"Our movement is fueled by young people who are not afraid to raise their voices or make enemies," he wrote on Twitter. "Tonight’s victory is a tribute to those young people and to their vision. They will save us if we trust them. And I do."

He added: "This election is an undeniable mandate for change. Tonight is just the beginning for our movement."

RELATED VIDEO: JFK's Last Surviving Sibling, Former Ambassador Jean Kennedy Smith, Dies at 92

Joe — who shares two children, daughter Eleanor and son James, with wife Lauren Birchfield Kennedy, whom he married in 2012 — opened up about growing up Kennedy in a 2017 interview with Town & Country.

“People come up every day and usually say very nice things about my family, but sometimes not," he said at the time. "You get both.”

“Look, my family means different things to different folks,” he continued. “I think for most people they have very fond memories and believe my family made important contributions to the country. And I happen to believe so too, and I’m grateful when people do mention that and share their stories: ‘I shook your grandfather’s hand,’ or JFK’s hand, or ‘I met your Uncle Teddy.’”