“I warmed up today, and I felt that my knee was not good to compete at the level I needed to compete in [the] semifinals,” Nadal said.

Nadal said he won’t play again until the Monte Carlo Masters clay event in mid-April.

The Nadal-Federer matchup would have been the 39th meeting in their careers and the first in 16 months. Nadal leads the rivalry 23-15, but Federer has won the past five matchups.

The Spaniard’s right knee flared up in the second set of his 7-6 (2), 7-6 (2) victory over Karen Khachanov in Friday’s quarterfinals. He twice called for a trainer, who applied tape just below Nadal’s knee.

Nadal sounded dejected about his latest injury, saying it’s “tough for me to accept all these things that I’m going through in my career” but adding that he needs to be “positive and grateful” for what tennis has offered him.

Federer will face either Milos Raonic or Dominic Thiem in the Indian Wells final as he seeks a record sixth title at the tournament.