The Celtics appeared to be bidding against themselves as they renewed serious negotiations and agreed to a four-year, $52 million deal with Marcus Smart Thursday.

But they were willing to pass on a potentially bargain year of Smart at the qualifying offer of $6,053,719 to lock him up for multiple years and avoid an far more uncertain dance next summer when he could be an unrestricted free agent.

The interesting part of all this is that, based on this conclusion, Smart’s two and a half weeks of restricted free agency never had to be. Sources indicate he agreed to essentially the same contract the Celtics offered in an extension before this past season — a straight four years of increasing salaries with no opt outs for either side.

Smart had hoped to attract more on the market, but there were fewer available dollars this summer and teams didn’t appear interested in giving him an offer sheet the Celts would almost certainly match. As the free agent dominos fell, the only team left that really could have blown the Celts out of the water was Sacramento, but the Kings were not about to give large money to the 36 percent career shooter when they already have a young and crowded backcourt.

Smart’s side seemed prepared to take its chances in a better market next summer, and maybe if his offense took a step toward his defensive prowess, he could have cashed in. But $52 million and being in the right place under the right coach seemed the right move for all concerned.

The deal gives the Celtics a large measure of roster stability, with, at present, rookie Robert Williams and Brad Wanamaker replacing Greg Monroe and Shane Larkin, respectively. That’s a far cry from last summer when the Celts brought back just four players from a 53-win team.

And there is the chance the continuity will extend beyond 2018-19.

Only two players of major consequence not in the Celtics’ control (under contract or restricted free agents whose offers they can match). Kyrie Irving and Al Horford each have options to sever the final seasons of their deals, but the club is confident that things will work out with both.

Three agents told the Herald they fully expect Irving to opt out and leave next summer, but sources connected to the player reiterated in the last two days that, while there are miles to go between now and the end of the coming season, the All-Star guard is quite pleased with his Celtic surroundings and has been talking about the future here beyond 2018-19. There was, as well, a report from a generally credible radio source stating that the club had offered Irving to San Antonio in recent trade talks for Kawhi Leonard. But sources from both clubs stated adamantly that was never the case.

Still, while Irving was being open and honest in his most recent public comments when he said it made no sense financially or otherwise for him to sign an extension based on his current contract, one never knows if events could conspire this season to change his longer term view of the situation here.

But considering how quickly things can change in the NBA — and how drastically (hello, Cleveland) — the bottom line is that the Celtics are in extremely good shape for now and the next few years.

Even with Toronto acquiring Leonard for DeMar DeRozan, the locals are still the solid favorite to win the Eastern Conference’s invitation to the NBA Finals. As long as Irving and Gordon Hayward return in good health — and barring any other such injuries to multiple key players — anything less than a trip to the championship series would have to be considered an underachievement. Such is the weight of expectation under which the Celts will take the floor this season.

And they seem more than pleased with that challenge. For example, said Jaylen Brown last week in Las Vegas, “We’ve got a lot of great talent on this team with a great coach, so, you know, we’re thinking we’re trying to raise a banner.”

Even should Irving and Horford choose to leave after this year, the Celts are still poised to rebuild on the fly based on the presence of Hayward and still young and improving talents like Jayson Tatum, Terry Rozier, Brown and even Smart, who will be just 25 next summer.

The Celtics, in the event of those opt-outs, would also have some serious salary cap space to chase one of the better free agent classes.

In other words, Bostonians’ time with their worry beads can largely be spent on whether the Red Sox will play this way in October and with whom Tom Brady can play catch during Julian Edelman’s four-game absence.