The San Francisco 49ers have traded a 2018 second-round draft pick for New England Patriots quarterback Jimmy Garoppolo, sources told ESPN on Monday night.

San Francisco had two second-round picks, but the one traded for Garoppolo is its original second-round pick, a source said.

The 49ers and Patriots began discussing the trade Monday morning and by evening the trade was officially agreed upon. The 49ers have also decided to release veteran quarterback Brian Hoyer, a source said.

Garoppolo, 25, is scheduled to become an unrestricted free agent after the season. The 49ers are likely to keep him by signing him to a new deal or tagging him as their franchise player.

That would mean Washington Redskins quarterback Kirk Cousins will have one less landing spot in free agency.

For the Patriots, they are on their bye week, during which they will have extra time to find a backup quarterback via trade or free agency. They will have until Tuesday's 4 p.m. ET trade deadline to explore that avenue. But they would seem to have bought into the idea that Tom Brady can play well into his 40s.

Garoppolo started New England's first two games in 2016 amid Brady's four-game "Deflategate" suspension before spraining his shoulder. Garoppolo was 42 for 59 with four touchdowns and no interceptions in the two wins for the eventual Super Bowl champions. For Garoppolo, a second-round pick in the 2014 draft by the Patriots out of Eastern Illinois, it has been his only significant playing time in the NFL.