If Celtics president of basketball operations Danny Ainge left any question about his desire to compete for a title next season, he eliminated such uncertainty Tuesday when the team agreed to terms on a three-year contract with veteran sharpshooter Jason Terry, according to an NBA source.

Terry, 34, played the past eight seasons with the Dallas Mavericks, establishing himself as one of the game’s top sixth men. He averaged 15.1 points this season in 31.7 minutes per game, shooting 37.8 percent from 3-point range.

When asked if he will sign with the Celtics, Terry responded “strong possibility” via text message.

Terry, who officially can sign a contract July 11, will sign for the full mid-level exception that begins at $5 million per season. The Mavericks, according to the source, offered Terry more money per season to return but only a two-year deal.

Terry agreed to the deal while at an AAU basketball tournament in Orlando, Fla., where his daughters were participating. The 10th overall pick in the 1999 draft, Terry spent his first five seasons with the Hawks before being traded to the Mavericks in August 2004 in a deal that included former Celtic Antoine Walker.

Terry is fourth in league history with 1,788 3-pointers, trailing only Ray Allen, Reggie Miller, and former teammate Jason Kidd. The Mavericks also lost out on point guard Deron Williams, who chose to sign with the Nets.

The Celtics have re-signed Kevin Garnett to a three-year deal, are close to bringing back Jeff Green, and now have added Terry to their lineup in hopes of challenging the defending NBA champion Heat in the Eastern Conference.

It’s unclear how the addition of Terry affects Boston’s pursuit of Allen, who is expected to visit Thursday with the Heat. The Clippers and Grizzlies also are interested. Allen was never comfortable with the role that Terry would fill – coming off the bench for instant offense. And because he is their own free agent, the Celtics can exceed the salary cap when offering Allen a contract.

The Celtics are still in play to re-sign power forward Brandon Bass, who is being courted by as many as six teams.

The club also is in line for a backup center and perhaps a backup to point guard Rajon Rondo.

. . .

The Celtics agreed to terms with first-round draft picks Jared Sullinger and Fab Melo and second-round pick Kris Joseph.

The trio will begin play Monday for the team’s summer league entry in Orlando.

NBA rookie salaries are structured depending on draft slot for first-rounders, while second-rounders can agree to non-guaranteed contracts.

Gary Washburn can be reached at gwashburn@globe.com.

© Copyright 2012 Globe Newspaper Company.