Everton’s Leighton Baines has had surgery on a persistent ankle problem in an attempt to ensure he is pain-free for the first time in three years.

The 30-year-old left-back had the operation on Wednesday and will miss the club’s last two matches of the season as well as England’s friendly against the Republic of Ireland and the Euro 2016 qualifier in Slovenia next month.

Baines was forced off with the problem in the second half of last Saturday’s defeat by Sunderland, prompting Everton’s medical team to look again at the injury.

Roberto Martínez, the manager, said: “Leighton had a little bit of instability in his ankle and in the last two weeks it flared up and against Sunderland the pain he was having was intolerable.

“We got it checked and it needed a little bit of repair work so he had the surgery yesterday. It was a straightforward operation just to clear the ankle so he will be out now until the start of pre-season but it is exactly what he needed.”

The Everton manager added that Baines had been managing the problem for a few years but it had been exacerbated in recent weeks – and, with nothing to play for in the remainder of the season, the club decided to take action.

“He was trying to play through the pain barrier,” Martínez said. “It has been a problem since 2012 and the ankle has been showing signs in the last two weeks that it needed some work.

“Leading up to the Manchester United game [on 26 April] was the first time he had it in an acute state and it was difficult for him to play pain-free. It is one of those situations that doesn’t affect you for a period and then you get a knock or a bad movement and it flares up and becomes really painful.

“The specialist saw him yesterday and everything was very quick. The work that has been done gives really good stability to a problem he has had for a long time and at the start of the next campaign I feel we will get the real benefit.”

Baines’ absence for Everton’s remaining two matches, plus a broken metatarsal injury to Bryan Oviedo, means the youngster Luke Garbutt may get his chance at left-back. The 21-year-old is out of contract at the end of the season and has yet to agree terms on a new deal despite Martínez insisting they want to keep him.

“From our point of view it doesn’t change anything; we have put a lot of effort on Luke Garbutt’s development in the last two years and we want him to stay at the club,” he said. “It is his decision which is the most important out of the two parties.

“But we are very strong in that department. Leighton Baines has been incredible for us in that role, we have Bryan Oviedo who is another full international and Luke Garbutt represents an academy product who is ready to perform.”