The Credit Suisse chief executive, Tidjane Thiam, has been ousted in the wake of a saga involving corporate espionage, an alleged car chase and personal vendettas that has sent shockwaves through Switzerland’s famously discreet banking community.

Thiam, widely seen as one of the finance world’s leading lights, resigned after losing a boardroom battle that erupted when the bank admitted to having hired private detectives to spy on former staff.

The bank’s board announced on Friday that it had “unanimously accepted” the 57-year-old’s resignation and that Thomas Gottstein, the head of Credit Suisse’s domestic business in Switzerland, will take over as chief executive.

While directors backed the departure of the bank’s French-Ivorian boss, who was paid Sfr 12.7m (£10m) last year for his services, they swung behind Urs Rohner, its Switzerland-born chairman.

Rohner is expected to complete a term scheduled to last until April 2021, despite the intervention of the bank’s biggest investor on Friday, who called for the chairman to fall on his sword as well.

Thiam and Rohner have been at loggerheads since it emerged last year the Zurich-based bank had hired a corporate espionage company to follow Iqbal Khan, the former head of the bank’s wealth management division.

Khan was on leave from Credit Suisse before taking a job at arch-rival UBS. Credit Suisse insisted the use of private detectives was a one-off incident but then in December admitted a second executive, the bank’s former head of HR, had also been tracked. Rohner said on Friday that the emergence of the second spying case had “made the situation worse” and had forced the board to act.

As rumours swirled about the genesis of the affair, sources told the Financial Times last year that Khan’s departure from Credit Suisse followed a period in which he and Thiam had developed a personal animus towards one another.

Khan was a rising star within the bank who was often talked about as a potential successor to Thiam, thanks to his success leading a wealth management division that enjoyed increasing profits and a burgeoning global reputation. While the pair got on well at first, they allegedly clashed outside the office over issues that arose between them as next-door neighbours in the Herrliberg area of the so-called “gold coast” of Lake Zurich.

Thiam complained to the bank about the inconvenience caused by lengthy renovations to Khan’s home, the FT said.

Khan later clashed with Thiam’s partner during a cocktail party, in a disagreement that supposedly revolved around some trees planted on the Thiam property. During a subsequent confrontation, the two men had to be physically separated, Khan told the Swiss newspaper Tages-Anzeiger.

As a result of their personal feud, Khan, who was also said to have been frustrated with his lack of profile at the bank, was reportedly allowed to leave with a shorter notice period than would usually apply. The bank then hired private investigators to follow him, amid concern he might poach talented staff from Credit Suisse.

Khan has alleged that three men employed by private security firm Investigo chased him and his wife through the streets of Zurich in a car, leading to a physical confrontation. Investigo has said there was only one man, that it was Khan who did the chasing and that its staff kept their distance.

Rohner initially supported Thiam over the affair but when it emerged that a second executive had been under surveillance – Peter Goerke, the former head of HR at Credit Suisse – relations between the two became strained.

In an interview with Bloomberg Television this week, Credit Suisse’s largest investor suggested that Thiam may have encountered racial bias in the Swiss banking industry.

David Herro of Harris Associates said: “To be very frank, it seems [like] envy from competitors or perhaps something else given that Mr Thiam looks a little bit different than the typical Swiss banker. Either one of these two rationales behind these attacks against him, to me are extremely distasteful.” Herro added on Friday that he believed Rohner should follow Thiam out of the bank.

An investigation by an external law firm in October formally cleared Thiam of involvement in the Khan spying affair and resulted in Pierre-Olivier Bouée, the chief operating officer and Thiam’s closest ally, being fired over the Khan dispute.

It also emerged that a private security consultant who had helped Bouée organise the spying had apparently killed himself.

Earlier this week Thiam appeared to have the upper hand in Rohner’s attempt to oust him, gaining the backing of several top Credit Suisse shareholders.

However, on Friday he said he had agreed with the board to step down as chief executive. “I had no knowledge of the observation of two former colleagues. It undoubtedly disturbed Credit Suisse and caused anxiety and hurt. I regret that this happened and it should never have taken place.”

Sign up to the daily Business Today email or follow Guardian Business on Twitter at @BusinessDesk

Thiam will step down after presenting the bank’s annual results next week. The news of his departure sent Credit Suisse’s share price down 4% in early trading but the stock later recovered its losses.

Rohner told Swiss radio: “At some point we realised that we couldn’t get out of this situation unless we made a change and Tidjane Thiam understood that too.

“Tidjane has made an enormous contribution to Credit Suisse since he joined us in 2015. It is to his credit that Credit Suisse is standing on a very solid foundation and has returned successfully to profit.”

Dismissing suggestions of xenophobia in appointing a Swiss successor to Thiam, Rohner said of Gottstein: “One thing that was not a factor was the colour of his passport,” he said.