The San Francisco 49ers have agreed to trade quarterback Alex Smith to the Kansas City Chiefs, a league source confirmed to ESPN.com's John Clayton.

Kansas City will trade its second-round pick in the 2013 draft -- the second selection (No. 34 overall) in the round -- as well as another conditional mid-round pick in 2014 to acquire Smith from San Francisco, a league source told ESPN.

As a result of the trade, the Chiefs are expected to release former starting quarterback Matt Cassel, league sources told ESPN. Cassel has two years remaining on a $63 million, six-year deal he signed with Kansas City after he was acquired in a trade from the Patriots in 2009. He failed to live up to the lofty contract, however, and was benched during the 2012 season.

At this point, Smith will play under terms of his remaining contract, which calls for a guaranteed base salary of $8.5 million in 2013. There has been no discussions between the Chiefs and Smith's representatives about negotiating a new contract.

49ers left tackle Joe Staley, one of Smith's closest friends on the team, said in a text to ESPN NFL Insider Ed Werder that he was happy the quarterback will get a chance to play with his trade to Kansas City.

"I am happy he is going to get a shot to play somewhere. He is too talented not to. Will miss him on our squad but will still be close wherever he goes. Happy for his new opportunity," he wrote in the text.

49ers tight end Vernon Davis, who developed a great on-field chemistry with Smith in the team's passing game, also wished the quarterback the best with his new team in another text to Werder.

He wrote: "I will miss him dearly and wish him the best as he starts something new. I'm sure everything will work in his favor. He is definitely a great player who I strongly believe had a big impact on my career. Love you Alex!"

The trade can't be officially completed until March 12 when the 2013 league year begins.

The trade agreement was first reported by Fox Sports.

Smith, the 2005 No. 1 overall draft pick, lost his starting job to Colin Kaepernick while sitting out with a concussion but was professional at every turn and continued to mentor his replacement.