(CNN) -- David Beckham was upstaged on the day his AC Milan future was finally resolved as teammate Filippo Inzaghi fired a hat-trick in the 3-0 success over Atalanta at the San Siro on Sunday.

David Beckham congratulates hat-trick hero Filippo Inzaghi as the San Siro enjoys a double celebration.

Milan confirmed in a brief statement a deal had been reached with Los Angeles Galaxy over England international Beckham. "AC Milan announces that the player David Beckham will remain at the club until June 30, 2009," it read.

The 33-year-old midfielder will then return to the United States to play for the Galaxy between July and October.

"I'm grateful to both clubs for allowing this dream to come true," Beckham said in a statement posted on www.gazzetta.it.

What do think of Beckham's move to play in the U.S. and Italy?

"It will enable me to play for Milan and the Galaxy in the same season, with the possibility of been able to keep up my commitments with Major League Soccer and the development of soccer in the United States, something which I'm very passionate about."

The deal follows weeks of negotiations between the two clubs during which Milan baulked at the size of the transfer fee Galaxy were demanding -- thought to be around £12million.

Galaxy's chief executive, Tim Lieweke, admits the deal is one which suits both clubs. "I'm sorry that it had to go for so long, for him and for us and particularly for the fans," he told the Los Angeles Times.

"This is a good solution. It allows him to finish the season with Milan. We will see him in July."

Coach Carlo Ancelotti admits Beckham has exceeded all expectations during his first two months as an AC Milan player.

"Beckham has done more than we could have possibly expected from him," Ancelotti told PA Sport. "He has settled in very well with the squad and given a huge contribution up to now.

"He is very professional and we are all very, very happy that he is staying."

He added: "The aim was to keep him until June 30 and we have done that. He is very happy with the solution that has been found and we will make the most of having him now and then we will see."

Sunday's victory gave Milan a five-point gap over fourth-placed Fiorentina, who lost 2-0 at home to Palermo.

Ancelotti said Inzaghi had helped lift the club out of a crisis after their UEFA Cup exit.

"He gave us a real helping hand. It was a tough match and for most of the first half Atalanta caused us problems," he said.

"Then Pippo's ability to find the right place to be in allowed us to end the match well. We were in a crisis and now I hope that this result has put an end to the crisis."

Only the top three in Serie A will go straight into next season's Champions League group stages with the fourth place finisher having to negotiate two qualifying rounds.

With his contract uncertainty behind him, Beckham seemed to have a new lease of life and he was even given a free role behind forwards Inzaghi and Pato by Ancelotti.

The former England captain dictated the play and helped open the way for Milan to take a seventh-minute lead when Marek Jankulovski firied across goal for the unmarked Inzaghi to score.

Milan had to wait until the 71st minute for Inzaghi's second. He beat the offside trap to latch onto Pato's chip and take the ball around Consigli before slotting home.

Moment's later Inzaghi was once again in the right place at the right time to tap in Gianluca Zambrotta's pass from close range.

After that Ancelotti took both Inzaghi and Beckham off to give the fans the chance to show their appreciation for both players.

There was no change to the top three in Serie A as Inter Milan and Juventus both won on Saturday, 2-0 at Genoa and 1-0 at Torino
( CNN ) -- David Beckham was upstaged on the day his AC Milan future was finally resolved as teammate Filippo Inzaghi fired a hat - trick in the 3 - 0 success over Atalanta at the San Siro on Sunday . David Beckham congratulates hat - trick hero Filippo Inzaghi as the San Siro enjoys a double celebration . Milan confirmed in a brief statement a deal had been reached with Los Angeles Galaxy over England international Beckham . " AC Milan announces that the player David Beckham will remain at the club until June 30 , 2009 , " it read . The 33-year - old midfielder will then return to the United States to play for the Galaxy between July and October . " I 'm grateful to both clubs for allowing this dream to come true , " Beckham said in a statement posted on www.gazzetta.it . What do think of Beckham 's move to play in the U.S. and Italy ? " It will enable me to play for Milan and the Galaxy in the same season , with the possibility of been able to keep up my commitments with Major League Soccer and the development of soccer in the United States , something which I 'm very passionate about . " The deal follows weeks of negotiations between the two clubs during which Milan baulked at the size of the transfer fee Galaxy were demanding -- thought to be around £ 12million . Galaxy 's chief executive , Tim Lieweke , admits the deal is one which suits both clubs . " I 'm sorry that it had to go for so long , for him and for us and particularly for the fans , " he told the Los Angeles Times . " This is a good solution . It allows him to finish the season with Milan . We will see him in July . " Coach Carlo Ancelotti admits Beckham has exceeded all expectations during his first two months as an AC Milan player . " Beckham has done more than we could have possibly expected from him , " Ancelotti told PA Sport . " He has settled in very well with the squad and given a huge contribution up to now . " He is very professional and we are all very , very happy that he is staying . " He added : " The aim was to keep him until June 30 and we have done that . He is very happy with the solution that has been found and we will make the most of having him now and then we will see . " Sunday 's victory gave Milan a five - point gap over fourth - placed Fiorentina , who lost 2 - 0 at home to Palermo . Ancelotti said Inzaghi had helped lift the club out of a crisis after their UEFA Cup exit . " He gave us a real helping hand . It was a tough match and for most of the first half Atalanta caused us problems , " he said . " Then Pippo 's ability to find the right place to be in allowed us to end the match well . We were in a crisis and now I hope that this result has put an end to the crisis . " Only the top three in Serie A will go straight into next season 's Champions League group stages with the fourth place finisher having to negotiate two qualifying rounds . With his contract uncertainty behind him , Beckham seemed to have a new lease of life and he was even given a free role behind forwards Inzaghi and Pato by Ancelotti . The former England captain dictated the play and helped open the way for Milan to take a seventh - minute lead when Marek Jankulovski firied across goal for the unmarked Inzaghi to score . Milan had to wait until the 71st minute for Inzaghi 's second . He beat the offside trap to latch onto Pato 's chip and take the ball around Consigli before slotting home . Moment 's later Inzaghi was once again in the right place at the right time to tap in Gianluca Zambrotta 's pass from close range . After that Ancelotti took both Inzaghi and Beckham off to give the fans the chance to show their appreciation for both players . There was no change to the top three in Serie A as Inter Milan and Juventus both won on Saturday , 2 - 0 at Genoa and 1 - 0 at Torino
what was milan's score?
what was milan 's score ?
3-0
3-0