Free-agent forward Ryan Anderson is headed to the Houston Rockets on a four-year deal worth $80 million, his agency, Octagon, told ESPN's Marc Stein.

The Rockets met with the former Pelican on Saturday afternoon and finalized the terms following a nearly two-hour meeting.

Anderson is the first major free agent obtained by the Rockets this summer. The team held meetings with Kent Bazemore, Al Horford and Anderson in an attempt to upgrade a roster that went 41-41 last season.

Anderson arrived in New Orleans via a sign-and-trade with the Orlando Magic, with whom he won the league's most improved player award in 2011-12. He quickly established himself as a potent offensive option next to budding superstar Anthony Davis, with the ability to hit 37.7 percent of his 3-pointers at power forward.

But Anderson's four-year stint with the Pelicans was marred by injury and tragedy. He missed 97 games, including 60 in 2013-14 after a collision in Boston led to him being removed from the court on a stretcher and later having surgery to address a herniated cervical disk. He was held out of the Pelicans' final 14 games last season because of a sports hernia.

In August 2013, his girlfriend, reality television actress Gia Allemand, committed suicide in New Orleans. Anderson built a strong bond with then-Pelicans coach Monty Williams and his wife, Ingrid, through the event and remained close to the family even after Williams was fired last summer. Ingrid Williams died in a car accident in February, and Anderson spoke often about his grief and appreciation for her.

Anderson reflected on his New Orleans tenure in early March, saying, "I grew up a lot over the past four years. You can't take things too seriously. This game can frustrate you, it can get in your head, but there's more important things in life, and I think that's definitely what it's taught me here. But, yeah, this four years have been a big molding point in my life, I think. To really change my mind about how I think about life in general. It's changed me outside of basketball more than it has inside of basketball."

Three-point specialist Ryan Anderson is headed to Houston after agreeing to a four-year deal worth $80 million. AP Photo/Max Becherer

The 28-year-old has averaged 13.1 points and 5.6 rebounds per game with a 17.8 player efficiency rating in eight seasons since being drafted 21st overall out of California in 2008 by the then-New Jersey Nets. He finished sixth in sixth man of the year voting last season after averaging 17 points and six rebounds per game for the 30-52 Pelicans.

Houston came into the weekend meeting with center/power forward Horford, but once he agreed to a deal with Boston, the Rockets moved along in filling their needs.

The Rockets sought a power forward in free agency and got one in Anderson, whom they have sought for several years.

Finding another outside shooter to complement newly hired coach Mike D'Antoni's up-tempo offensive system was next.

In addition to agreeing to terms with Anderson, the Rockets also reached a deal with guard Eric Gordon, a source told ESPN's Chris Broussard.

Anderson A Threat From Deep Since entering the NBA in 2008-09, Ryan Anderson has made more 3-pointers than any other player measuring 6-foot-10 or taller. Most 3-Pointers By Players 6-Foot-10 Or Taller -- Since 2008-09 Player 3-Pointers Ryan Anderson 980 Channing Frye 832 Kevin Love 742 Danilo Gallinari 710 -- ESPN Stats & Information

Information from ESPN's Calvin Watkins and Justin Verrier was used in this report.