Linsanity is returning to the New York area.

Point guard Jeremy Lin has agreed to a three-year, $36 million deal with the Brooklyn Nets, sources told ESPN's Chris Broussard and Marc Stein.

Lin tweeted about joining the Nets on Friday morning.

Lin met with the Nets and New Orleans Pelicans on Thursday night in Palo Alto, California, a source told Broussard.

Lin, who turns 28 in August, signed a two-year, $4.3 million contract with Charlotte last July, but the contract contained an early-termination option that Lin triggered to explore free agency. He averaged 11.7 points, 3.2 rebounds and 3.0 assists over 26.3 minutes per game in his only season with the Hornets.

Lin signed a three-year, $25 million contract with the Houston Rockets after the Linsanity craze with the New York Knicks in 2011-12. The then-little-known second-year guard from Harvard scored at least 20 points nine times in a 10-game span and blossomed into one of the league's biggest stories at that time.

Lin reunites with Nets coach Kenny Atkinson, who was his assistant coach in New York when Linsanity began. Lin gave Atkinson a lot of credit for his development as a player.

The Nets should have around $40 million remaining in cap space to spend in free agency after reaching their first player agreement.

Information from ESPN's Chris Forsberg and Mike Mazzeo and The Associated Press was used in this report.