Andy Murray’s plan is to hang on until Wimbledon, to possibly bid tennis a fond farewell at home, where his legendary status is secure.

But he acknowledged that the possibility existed that he couldn’t play on through a painful hip condition and his exit from the Australian Open came prematurely Monday. In the fourth hour of his five-set match with Spain’s Roberto Bautista Agut, Murray bowed out with a gutsy 6-4, 6-4, 6-7, 6-7, 5-2 first-round loss that brought a prolonged standing ovation from the crowd at the Melbourne tournament.

“If this was my last match, as you say, it was an amazing way to end the game,” an emotional Murray said, with his mother recording the moment on her phone, “but it wasn’t enough tonight so congratulations to Roberto . . . Maybe I’ll see you again. I’ll do everything possible to try. If I do, I’ll need like a big operation and there are no guarantees to come back from it anyway. But I’ll give it my best shot."

And if this was his final match in Australia, as the video montage he was shown of other tennis champions wishing him well would seem to indicate?

“If this is my last match, I gave everything.”

Last week, Murray, who was knighted two years ago, announced that he expected that this would be his final season of competition.

“I spoke to my team, and I told them, ‘I cannot keep doing this,’” Murray said in an emotional news conference at that time in Melbourne. “I needed to have an end point because I was sort of playing with no idea when the pain was going to stop. I felt like making that decision.

“I said to my team, ‘Look, I think I can get through this until Wimbledon.’ That’s where I would like to stop playing. But I am also not certain I am able to do that.”

Murray, 31, became the first male British singles champion at a Grand Slam tournament in 76 years when he won the United States Open in 2012. The 2013 and 2016 Wimbledon champion, he also won Olympic singles gold in 2012 and 2016. He ascended to the No. 1 ranking in the world after the 2016 season and held that spot through the following Wimbledon.

He acknowledged last week that the pain in his hip has been intensifying despite the surgery he had last January. “Obviously, I’ve been struggling for a long time. I have been in a lot of pain. Well, it’s been probably about 20 months now,” he told reporters last week. “I have pretty much done everything that I could to try and get my hip feeling better, and it hasn’t helped loads. I’m in a better place than I was six months ago but still in a lot of pain. Yeah, it has been tough.”

Murray acknowledged that he could still play to a level, but “not a level that I’m happy playing at.” Of more concern is pain that has not yielded to anything he has tried. “Nothing helps because you are in lots, lots and lots of pain,” he said last week. “You cannot do what it is that you want to do, and you love doing. Or I can do it, but it’s not fun or enjoyable doing it anymore.

“That is what I have done. I have tried to deal with it, talked about it, but none of that makes my hip feel better, unfortunately. I wish it did, because if it did, it would be feeling brilliant right now. But it doesn’t.”