London - Ian McGeechan will leave Bath at the end of the season, the English Premiership club announced Wednesday.
The Scot's existing two-year contract expires next month.
By leaving the west country club the former Scotland international has, potentially, put himself in a position to coach the British and Irish Lions for what would be a fifth tour when they travel to Australia next year.
Lions officials, headed by McGeechan's former Scotland and Lions team-mate Andy Irvine, have made it clear they would like their coach to be free of club or international commitments in the run-up to the series with the Wallabies.
New Zealander Warren Gatland, currently coach of Six Nations Grand Slam champions Wales, remains the favourite for the Lions post.
Bath, the dominant force in English club rugby for much of the 1980s, are well adrift in the Premiership playoff race and are struggling to qualify for next season's European Cup.
They exited this season's edition at the pool phase, something that would not have gone down well with millionaire owner Bruce Craig, and last week the club, in front of their own fans, lost 26-6 to Northampton -- a defeat that led Bath staff to apologise to their supporters.
Bath chief executive Nick Blofeld said: "We would like to thank 'Geech' for his time with the club and for his assistance in developing the culture at the club through this transitional period.
"An announcement regarding a new head coach will be made in due course."
The 65-year-old McGeechan, who has also had spells in charge of Northampton, Wasps and Scotland during a lengthy coaching career, added: "I've really enjoyed being part of Bath Rugby and the challenge of leading the cultural change that has taken place, particularly over the last 18 months.
"The commitment of the players and staff during this significant transitional period has been outstanding. I will now take on the responsibility as head coach for the last three games."
Among those linked with the impending vacancy at the Recreation Ground are much-travelled former Springbok boss Nick Mallett, who recently lost out to Stuart Lancaster in the race to become England's new head coach, and his fellow South African Gary Gold, currently in caretaker charge of Premiership relegation favourites Newcastle.