Anthony Martial has signed a new contract that will keep him at Manchester United until June 2024 just months after he seemed set to leave, the Premier League club announced on Thursday.

The 23-year-old Frenchman, who moved to Old Trafford from Monaco in 2015, has scored eight Premier League goals this season.

“I am loving my time at this club,” said Martial, whose new deal includes the option to extend for a further year.

“From the day I joined I have been made to feel part of the United family and I have been incredibly humbled and overwhelmed by the warmth and love of our fans, who continue to amaze me with their support.

“I would like to thank [interim boss] Ole [Gunnar Solskjaer] and his coaching staff for their belief in me and for helping me to take my game to the next level. This club is all about winning trophies and I am sure the next piece of silverware is not that far away.”

Martial signed from Monaco for an initial £36 million ($47 million) and became the most expensive teenager in the world but until recently it appeared a matter of when rather than if he would leave Old Trafford.

The forward’s agent Philippe Lamboley indicated in June that his client wanted to seek a new challenge and former boss Jose Mourinho was reportedly willing to sell him, although executive vice-chairman Ed Woodward made clear he wanted to keep the player.

Martial was fined by Mourinho after failing to return to the club’s pre-season tour of the United States following the birth of his second child and was on the fringes of the side in the early weeks of the campaign.

But the Frenchman has been an integral part of the side since Solskjaer replaced the sacked Mourinho in December.

“Anthony is one of those naturally gifted players that any coach would love to work with,” said the Norwegian interim boss.

“For a young man, he has a good footballing brain which, when coupled with his exceptional talent, makes for a player with an exciting future ahead of him.”

While Martial commits his future to the club, Marouane Fellaini is reportedly set to end his five-and-a-half year stay at Old Trafford, with United understood to have reached an agreement in principle regarding his sale to Chinese club Shandong.

It is understood that the Belgium international has already passed a medical, leaving paperwork and final terms to iron out.

Fellaini posted an Instagram photo of himself at an airport on Thursday, with the phrase “let’s go” written across it.