Paris Saint-Germain hopes to strike a deal with David Beckham in the next two weeks in which the former England captain will work with the French club after retirement, possibly in an ambassadorial role.

PARIS — David Beckham hugged his teammates with tears in his eyes, then walked off the pitch to a standing ovation — for the last time in front of a home crowd at a football game.

A clearly emotional Beckham was mobbed by his teammates on the field when coach Carlo Ancelotti decided to substitute him in the 81st minute of a 3-1 win over Brest on Saturday, giving him a customary sendoff in his last home game before retiring. Even goalkeeper Salvatore Sirigu ran out to congratulate the former England captain on his career, while Brazil winger Lucas bowed in reverence.

“To end my career in front of a crowd like that, with players like that, it’s very special,” Beckham said, adding that emotions had already started overpowering him before he was taken off.

“It started about 20 minutes before that, to be honest. I started thinking and then, you know, I couldn’t concentrate by then, and it was difficult,” he said. “You know, you try to hold the emotion back because it is what it is, but it’s difficult.”

As the crowd rose to its feet — including former President Nicolas Sarkozy — Beckham applauded in return as he walked off the pitch slowly before being replaced by Ezequiel Lavezzi.

“I want to say thank you to everybody in Paris. To my teammates, to the staff, to the fans,” Beckham told the fans. “It’s been very special to finish my career here. It could not have been any more special.”

With PSG already having clinched the French league title, Beckham announced Thursday that he is retiring at the end of the season. He has yet to say whether he intends to play in PSG’s last game away against Lorient on May 26.

“I just feel that it’s the right time. I feel that I’ve achieved everything that I could in my career. I wanted to go out as a champion,” Beckham said. “I’ve finished my career in a team that has treated me like I’ve been here for 10 years.

PSG coach Carlo Ancelotti said it was unlikely that Beckham would feature in the last game of the season away to Lorient on May 26.

“We have to decide, but I don’t think he will play. He will come with the team but I don’t think he will play ... a plastic pitch is difficult for a 38-year-old,” Ancelotti said, before praising Beckham’s impact on world football.

“He will miss the world of football because he showed a good image every time, really professional. It was a fantastic evening for him. He will have a very good memory of this night,” Ancelotti said. “When you finish, when you stop, you have memories of all the years.”

Ancelotti joked that Beckham should have scored.

“I spoke with David and told him in my last game I scored two goals,” Ancelotti said “I said to him ‘Maybe tonight you’ll score two goals’ - but maybe he didn’t have my quality.”

While Zlatan Ibrahimovic again was PSG’s main figure on the field, scoring twice, this game was Beckham’s moment from the start.

He was given the captain’s armband for the first time since joining the team on the last day of the January transfer window, and was given a rousing reception at Parc des Princes before the game, with fans breaking out into chants of “Merci, David” (Thank You, David) when his name was read out over the stadium speaker.

“After 22 years of playing football I’m going to take a few months to enjoy time with my family,” Beckham said, before adding that he still wants to stay involved with PSG. “It’s been a very special place for me.”

Paris Saint-Germain hopes to strike a deal with David Beckham in the next two weeks in which the former England captain will work with the French club after retirement, possibly in an ambassadorial role.

He showed he can still contribute on the field as well, setting up midfielder Blaise Matuidi for 2-0 with a well-taken corner in the 31st minute.

And when it came time to leave the pitch, chants of “Dav-eed Beckham, Dav-eed Beckham” broke out among the French fans as the PSG players trotted over to embrace him. Even Brest’s Charlison Benschop — who had scored the team’s consolation goal a minute earlier — walked over to shake his hand.

“It’s a historic moment,” the stadium announcer intoned as Beckham was substituted. He said “Dav-eeeed” and the 44,983-strong crowd roared back “Beeeeeck-ham!”

As Beckham walked slowly off with his hair uncharacteristically bedraggled, his mother, Sandra, also wiped away a tear in the stands.

Beckham said he had invited 25 people to watch him: “friends, family, everyone that’s been with me throughout my career.”

His replacement Ezequiel Lavezzi, gave Beckham a bear hug and then cheekily ruffled the fashion icon’s hair. Beckham immediately swept it back into place.

After blowing a kiss to wife Victoria and his children in the stands as he walked off, there was time for one more hug — this one a bit longer from Ancelotti — before he sat down on the bench, maybe for the last time.

The game brought a stronger security presence, with about 150 riot police forming a ring inside the stadium in the second half. The show of force follows Monday night’s riots at Trocadero plaza, where a celebration to mark the French title turned violent.

PSG clinched the league title last weekend, making Beckham the first English player to win the championship in four different countries after title success with Manchester United, Real Madrid and the Los Angeles Galaxy.

Saturday’s match was Beckham’s 14th since joining PSG, and his fifth start.

After the final whistle, his teammates hoisted Beckham off the ground and repeatedly tossed him up in the air, putting a smile back on his face.

The league title celebrations then kicked in as the lights were turned off, as light sticks were held up and the crowd broke out into song. Fireworks then flew into the night sky — accompanied by an “Ole!” as each one went off.

One after the other, the players then walked out onto a makeshift podium and thanked the crowd.

When it came to Beckham’s turn to climb onto the podium, the Beatles song ‘Hello, Goodbye’ rang out as the stadium’s big screen beamed pictures of Beckham’s short PSG career and flashed up another message of thanks.

Draped in the English flag, it was Beckham’s turn to offer some final words to the crowd.

“Merci, Paris,” Beckham said. “I’m very sad to be leaving, but thank you.”