Germany welcomed the release on Sunday of a German writer detained in Spain on a Turkish warrant and accused Turkey of abusing the international system used to hunt down fugitives.

Turkish-born writer Doğan Akhanlı, who has German citizenship, was arrested on Saturday while on holiday in southern Spain. Akhanlı was conditionally released after a court hearing on Sunday, but ordered to remain in Madrid while Turkey’s extradition request is considered, his lawyer said.

It was not immediately clear what Akhanlı is accused of, but the author has in the past written about the mass killing of Armenians in Turkey in 1915. The killings are a sensitive subject in Turkey, which rejects the widespread view that they constituted genocide.

In a statement, the German foreign minister, Sigmar Gabriel, praised Akhanlı’s release and said “it would be terrible if Turkey could get people who raise their voice against [Turkish president Recep Tayyip] Erdoğan imprisoned on the other side of Europe.

“I have complete faith in Spain’s judicial system and know that our friends and partners in the Spanish government understand what’s at stake,” Gabriel said.

Erdoğan hit back while speaking to supporters in Istanbul, attributing Ankara’s souring relations with Berlin to next month’s German election and warning Germany to “mind its own business”.

The German chancellor, Angela Merkel, said the arrest of Akhanlı was wrong.

“We mustn’t abuse international organisations like Interpol for this,” she told German broadcaster RTL.

German chancellor Angela Merkel has called Turkish president Recep Tayyip Erdoğan’s remarks on the German election ‘unacceptable’. Photograph: Sebastian Kahnert/AP

The already high tensions between the two countries hit another peak on Friday when Erdoğan said all of Germany’s mainstream parties were enemies of Turkey and urged Turkish-Germans to not vote for them in the upcoming election.

Merkel called Erdoğan’s comments “completely unacceptable”.

“I invite everyone to vote, here in a free country,” she said.

Merkel said she would work hard to improve prison conditions for a number of Germans currently detained in Turkey on accusations of supporting banned organisations.

Akhanlı emigrated to Germany in 1991 after spending years in a Turkish prison following the 1980 military coup in the country.

The German section of the writers’ association PEN called the arrest warrant against Akhanlı politically motivated.

Spain is also holding Turkish-Swedish reporter and writer Hamza Yalcin, who was arrested on 3 August in Barcelona on a Turkish warrant for alleged terrorism.

PEN and Reporters Without Borders have demanded his release. The Swedish branch of Reporters Without Borders said Yalcin’s arrest was an attempt by Erdoğan to show he can reach critical voices abroad.

Spain’s Freedom of Information Defence Platform said it welcomed the decision on Akhanlı, but reiterated that it expects Yalcin to be let go and Spain to explain both arrests.