The Miami Heat and Goran Dragic have quickly reached terms on a new deal to keep the guard on South Beach for the long term, according to league sources.

Sources told ESPN.com that the Heat and Dragic will execute a new five-year contract worth $90 million on July 9, which is the first day players can officially sign new contracts.

Free agency began Wednesday at midnight ET, with teams and players permitted to strike verbal agreements on new contracts while waiting for a leaguewide moratorium on player business to be lifted in eight days.

Dragic Elite On Inside Shots In the past 15 seasons, Goran Dragic is one of three players shorter than 6-foot-6 to shoot at least 67 percent from 4 feet and closer (minimum 300 field goal attempts) in a season: Player Pct. Tony Parker, 2005-06 68.7 Goran Dragic, 2014-15 68.2 Dwyane Wade, 2013-14 67.8 Dwyane Wade, 2012-13 67.7 Dwyane Wade, 2009-10 67.4 -- ESPN Stats & Information

Sources say Dragic agreed to the terms while in his native Slovenia and will have the option to return to free agency after Year 4 of the new pact.

The contract will be by far the most lucrative of Dragic's career, but the crafty lefty did agree to take less than the five-year maximum he could have commanded to help Miami maintain extra flexibility for its looming negotiations with Dwyane Wade and the pursuit of marquee free agents such as Oklahoma City's Kevin Durant in the summer of 2016.

Dragic was eligible for a five-year max deal from Miami worth in excess of $100 million and four-year maxes from interested rival teams valued at $85 million, but he made it clear for months, almost from the moment he joined the Heat in February in a deadline-day trade with the ‎Phoenix Suns, that he wanted to stay with his new team.

Sources told ESPN.com's Ramona Shelburne on Wednesday that Dragic asked Pat Riley how he could be flexible to help the Heat re-sign Wade before he agreed to his new deal.

Heat center Hassan Whiteside tweeted congratulations to his teammate on his new deal.

Congrats @Goran_Dragic on new deal welcome back to the family and let me borrow 5 dollars 💯 lol #HeatNation — Hassan Whiteside (@youngwhiteside) July 1, 2015

‎The 2014 All-NBA third-team selection told local reporters after the season that he "had a great time" with the Heat despite missing out on the playoffs. He said on more than one occasion that "I want to come back."

Heat president Pat Riley has likewise expressed long-standing confidence in Miami's ability to retain him, saying at a season-ending media availability two months ago: "If he doesn't sign, my ass will be in that seat [next to reporters] ‎next year."

The Heat are now expected to focus on coming to terms with Wade, who passed on his $16.1 million player option for next season to become a free agent. It's believed Wade is seeking a three-year deal worth at least $45 million.

The Heat acquired Dragic from Phoenix at the trade deadline for two future first-round picks and a combination of mostly seldom-used role players. He shot 50.1 percent from the field and averaged 16.6 points and 5.3 assists in 26 games for the Heat.