The next chapter of Linsanity will be written in Brooklyn

Jeremy Lin agreed to a free-agent deal with the Brooklyn Nets on Friday.

According to reports, he will get $36 million over three years.

Lin, 27, revived his career as a backup to point guard Kemba Walker for the Charlotte Hornets this past season. In 78 games, he averaged 11.7 points, 3.0 assists and 3.2 rebounds. He opted out of his deal after the season.

The Nets will be his sixth franchise as he enters his seventh season in the league. He gained national attention when he rose from obscurity to stardom with the New York Knicks in the 2011-12 season, averaging 14.6 points and 6.2 assists per game.

In his six seasons in the NBA, Lin has averaged 11.7 points, 4.4 assists and 2.8 rebounds per game.