Gordon Hayward and Brad Stevens were a couple of inches from winning an NCAA championship together at Butler. They are now reuniting, to try for an NBA title.

The top remaining free agent in this summer’s class is now off the board, with Hayward announcing Tuesday night with an essay on the Players’ Tribune that he will sign with the Boston Celtics – coached by Stevens – and leave the Utah Jazz after seven seasons.

“This was a life-changing decision for me and my family, and something we took really seriously,” Hayward wrote. “And from the very start of this process, one thing stood out as important: I knew that I wanted the fans and the organizations to hear my decision directly from me. After seven years in Utah, I have decided to join the Boston Celtics.”

A person with knowledge of the negotiations said Hayward agreed to a four-year contract, the last of those years being a player option, with a total value of around $128m.

“Gordon has been an important part of our Jazz family for the past seven years,” Jazz owner Gail Miller said. “While disappointed that he is moving on, we thank him for his contributions to the organization and wish Gordon, [his wife] Robyn and their family well. “

It was a decision that Hayward said he agonized over, and he said he was impressed by the pitches – albeit unsuccessful ones – that Miami and Utah had made to him over the last few days. But his ties to Stevens, and the memories of how close they were to a title, seemed to weigh heavily on his mind throughout this process.

Butler went to the NCAA championship game in back-to-back seasons under Stevens in 2010 and 2011, losing to Duke and Connecticut. In the 2010 game, Hayward’s desperation shot to win the title from midcourt narrowly missed as time expired and Duke won 61-59. From there, Hayward went to the NBA. Not long afterward, Stevens followed. And now, they’re together again.

“That unfinished business we had together, back in 2010, when I left Butler for the NBA. As far as I’m concerned, all of these years later, we still have it: and that’s to win a championship,” Hayward wrote.

Hayward leaves a loaded Western Conference to join a Boston team that was the No 1 seed in last season’s Eastern Conference playoffs. He was finally an All-Star for the first time last season, averaging career bests of 21.9 points and 5.4 rebounds. Hayward also shot 47%, a significant jump over what he had managed in the previous four seasons.

His post capped a strange day, after it was widely reported in the early afternoon that Hayward had picked the Celtics – a decision immediately shot down by his agent, Mark Bartelstein, who said that Hayward was still going over his options.

“This has been the toughest decision that I’ve ever had to make in my life,” Hayward wrote. “This weekend has probably been the longest weekend of my life. And today ... well, today has definitely been one of the craziest days of my life. But I wanted to make sure that I got this right.”

He becomes the third prominent free agent in three years to announce his plans on the Fourth of July: LaMarcus Aldridge left Portland for San Antonio on that date in 2015, and Kevin Durant left Oklahoma City for Golden State on the holiday in 2016.

Hayward opted out of his contract and became a free agent late last month, a move that was expected. Utah could have been in position to offer Hayward the so-called Supermax deal – a five-year extension worth just over $200m – if he was selected to an All-NBA team after the season, but his vote total fell well short of making that list.

Other than the Golden State stars Stephen Curry and Kevin Durant, Hayward may have been the top free agent on the market this summer. And he clearly leaves Utah with the fondest of memories, going back to his start with Coach Jerry Sloan.

“I was literally the last Jazz player left who played under Coach Sloan – and I always took that as a lot more than just some piece of trivia,” Hayward wrote. “That was something that truly made me feel like a part of the fabric of this franchise. And that fabric is something that has meant a lot to me, ever since.”

Utah have been a team on the rise. But with the West still loaded – Golden State winning two titles in the last three years, Houston acquiring the All-Star point guard Chris Paul in an effort to move up and challenge the champs, and Oklahoma City getting Paul George to pair with the MVP Russell Westbrook – the best chance for Hayward to make an NBA finals may be trying to get there from the East.

Boston obviously agree. “Let’s get to it, Gordon Hayward,” the Celtics All-Star guard Isaiah Thomas wrote in a tweet Tuesday night featuring emojis showing two shamrocks and a watch.