Updated

David Beckham will leave Real Madrid at the end of the season to join the Los Angeles Galaxy of Major League Soccer in a five-year deal believed to be one of the richest in sports history.

The move was announced Thursday following the end of talks on extending the 31-year-old English midfielder's contract with the Spanish club.

"This week, Real Madrid asked me to make a decision regarding my future and the offer to extend my contract by a further two seasons," Beckham said in a statement.

"After discussing several options with my family and advisers to either stay here at Madrid or join other major British and European clubs, I have decided to join the Los Angeles Galaxy and play in the MLS from August this year."

Beckham's agents met with Madrid officials earlier Thursday to try to settle a long-running dispute about two-year contract extension.

"After the meeting, both parties agreed that David will not extend his current contract with the club, which ends on June 30, 2007," Madrid said on its Web site.

The Galaxy, citing industry experts, said the LA deal is worth more than $250 million in salary and commercial endorsements — about $1 million a week — and is "thought to be the biggest in sporting history."

"David Beckham is a global sports icon who will transcend the sport of soccer in America," MLS commissioner Don Garber said. "His decision to continue his storied career in Major League Soccer is testament to the fact that America is rapidly becoming a true 'Soccer Nation' with Major League Soccer at the core."

Beckham will become the biggest star to play soccer in the United States since Pele and Franz Beckenbauer played in the now-defunct North American Soccer League in the 1970s.

Beckham and his wife are worth $169 million, according to Britain's Rich List. Beckham alone reportedly makes about $32 million per year in salary and endorsements.

Beckham's four-year contract with Madrid expires at the end of this season. He joined the team from Manchester United in 2003, where he had had won six league titles, two FA Cups and the Champions League title.

But Beckham, the world's most recognized player, hasn't won a major trophy since joining Madrid.

"I have enjoyed my time in Spain enormously and I am extremely grateful to the club for giving me the opportunity to play for such a great team and their amazing fans," Beckham said.

Beckham has been unhappy this season at Madrid under coach Fabio Capello. He has started only seven of 25 matches and was left off the squad for Thursday's Copa del Rey match against Real Betis.

"For the rest of this season I will continue to give 100 percent to my coach, teammates and fans as I believe Fabio Capello will bring this club and its supporters the success they truly deserve," said Beckham, who trained with Madrid in the Spanish capital Thursday.

Before the season started, Beckham led England to the quarterfinals of the World Cup, scoring from a free kick in the second round to beat Ecuador 1-0.

But he was taken off the field early in the second half against Portugal with ankle and Achilles tendon injuries, and then watched as his team was eliminated in a penalty shootout.

A day after the game, Beckham stepped down as captain of the team — a post he had held for 58 of his 94 international appearances. Then, on Aug. 11, England coach Steve McClaren dropped Beckham from the team altogether, signaling the end of his international career.

Then came more heartache in Madrid.

He was injured in November when he was allowed to travel to Rome to visit Tom Cruise and Katie Holmes, but Beckham was forced to skip the wedding and return to Madrid to sit on the bench — another sign that his days in Madrid under Capello were numbered.

Still, the move to Los Angeles won't surprise many people. Beckham has a soccer academy in Carson, California, and his wife Victoria, a former Spice Girl, was recently photographed house-hunting in Los Angeles.

Los Angeles opens its season on April 8 in Houston.

"I'm going out there to hopefully build a club and team that's got a lot of potential," Beckham said. "I think that's what excites me."

MLS recently changed its rules on salary caps, clearing the way for Beckham to sign the lucrative deal and become the first player to be signed under the new rule.

"I don't think it's just about glitz," United States Soccer Federation president Sunil Gulati said. "He wants to play on a winning team and be part of a winning organization and help build the game in the United States."