Equatorial Guinea accused Spain yesterday of trying to overthrow its government in the alleged plot by foreign mercenaries to kill the president.

In an interview with the Guardian, President Teodoro Obiang's special adviser, Miguel Mifuno, accused Madrid of sending a warship to the country with 500 marines on board.

He alleged that they were to have been sent in to secure the capital after mercenaries had killed the president and ministers. Mr Mifuno, a former ambassador, is the president's closest colleague.

"Our intelligence sources say that the warship was going to arrive on the same date that the coup attempt was going to take place - March 8," he said.

"It was already in our territorial waters with 500 soldiers aboard. Meanwhile there was a team of foreign mercenaries already in Equatorial Guinea who knew where we lived. They had plans to kill 50 people and to arrest others.

"Spain was providing all the facilities for the coup. [The boat] was there to provide resources for the mercenaries."

Mr Mifuno also alleged that the Spanish government was funding opposition groups in exile: "Spain wants to decide who runs its former colony. Many countries knew the coup was going to happen, including the United States and several other west African countries."

The trial of 17 alleged mercenaries arrested in Guinea, including German and South African nationals, is expected to begin in Malabo within four weeks. One German has died of malaria while in detention.

A further 70 alleged mercenaries, who were also detained in March, face trial in Zimbabwe, accused of plotting to buy arms and planning to join the supposed coup attempt in Equatorial Guinea.

Lucie Bourthemieux, the Paris-based legal adviser to Equatorial Guineas's minister of justice, alleged that Spain had twice offered to send arms to the country just before the coup attempt, ostensibly to help it with a longstanding border dispute with Gabon.

"The president refused," she said. "He said that Equatorial Guinea had no need of arms. The president sent a letter confirming his refusal.

"Days later, the authorities received another message from Spain saying that the marines were coming. The president refused again, and sent a letter to the UN to clarify the matter."

Equatorial Guinea is one of the most strategically important African countries to the US, expected to provide it with up to 5% of its oil within a few years. President Obiang, believed to be one of the richest men in Africa, is accused by his critics of profiting handsomely from the oil reserves.

Malabo has some of the worst slums in Africa and there is little evidence that oil has benefited the vast majority of the country's people.

Yesterday a spokeswoman for the Spanish foreign ministry in Madrid denied that Spain had had anything to do with the alleged coup attempt in Equatorial Guinea. "There was no ship there," she said. "We deny any kind of implication in an attempted coup."

Spain had, by agreement with the government in Malabo, planned to send ships on an official visit to Equatorial Guinea in January. That visit was called off at the last moment due to some "misunderstanding" about the nature of the trip among the opposition to Mr Obiang and the Spanish press, according to a ministry statement at the time.

Last week Malabo was tense, with thousands of police on the streets stopping foreigners. Several thousand foreigners were expelled after the alleged coup attempt.