While Japan was setting up a World War II spy ring in the United States made up of Spain's diplomatic delegation, Germany was operating a similar ring in Great Britain headed up by Spanish diplomats in London.

Once the U.S. spy ring was running, both networks of agents were given the code name of "TO," which has two meanings in Japanese -- "door" and "east." Japan financed the Spanish ring in the United States, Germany financed the counterpart ring in Britain with Japan paying bonuses to the Spanish diplomats in London when "they did fine work."

Both spy networks were at least partly controlled from the Japanese embassy in Madrid, according to documents turned over to the National Archives by the National Security Agency. The documents are the translated versions of Japanese diplomatic cables whose codes had been broken by the United States.

The documents show that the Spanish ambassador to Britain, along with one of his key aides, put together a network of spies whose main target was movements of ship convoys. They passed the data and weather reports to the German submarine command.

The Spanish embassy in London eventually had in its network "5 Welshmen, 2 Irishmen, 11 Scotchmen, 2 Spaniards and possibly one other man." None of the agents is identified, but the two Spaniards were additional to the ambassador and his aide.

Germany financed the enterprise and supplied the agents with shortwave sets, and with secret inks to insert information between the lines of Spanish diplomatic messages sent out of London by courier to Madrid. The inked messages were sent along to Berlin to be read since neither the Japanese embassy nor the Spanish Foreign Ministry in Madrid was given the chemicals to bring out the invisible words.

The decoded cables show that the Spanish embassy in London organized its spy ring at the start of the war between Germany and Britain in 1939. Through Spanish Foreign Minister Serrano Suner, the messages were turned over to the Japanese embassy in Madrid "free of charge."

Although Japan paid bonuses when the Spanish agents did "fine work," just how much Japan paid for the services of the London network is not clear. An August 1942 cable suggests that the Japanese embassy in Madrid could draw on a revolving fund of at least $500,000 in Swiss francs.

Typical of the reports sent from London to Madrid was a cable dated July 12, 1942, which gave detailed descriptions and destinations of British warships setting out to sea. The July 12 cable also told of a nine-ship convoy leaving the British port of Southampton, what it carried and what kinds of warships were escorting it.

The accuracy of the London espionage was questioned at least once by Tokyo, which had been told in a single three-month period in 1942 that England had decided to invade Turkey, that a second air raid was contemplated against Tokyo "using British and American pilots," and that French West Africa was about to be attacked by the United States and Britain.

None of this was true, as Tokyo pointed out to the Japanese embassy in Madrid in the following cable:

"You do not know how grateful I am for your efforts in sending me continually very precious intelligence which you have gathered in strictest secrecy. Now judging from the phraseology and contents of these messages, however, there are often certain things which we find hard to believe; that is, things which do not appear necessarily to be factualy.

"Therefore, since everything you send us is of the highest importance, will you insofar as possible send us the proof of the messages."

Besides using Spanish diplomats as spies, according to the Archives documents, the Japanese embassy in Madrid paid bribes to Chilean government officials to spy on the United States and to keep Chile neutral in the war.

Three decoded cables in July 1942 said that the Japanese minister to Santiago was given 1 million pesos to "deposit" to the account of Florencio Duran, chairman of the Chilean Senate. A cable back to Tokyo said the money was "delivered" to Duran July 4.

Another time, the Japanese minister asked permission to pay 1,000 pesos a month to the "younger cousin" of the Chilean foreign minister.

This person "is advantageously placed to make private investigations of the views of the foreign minister," a cable from Santiago to Madrid said. "While carrying on his profession as a lawyer, he can gather intelligence of the financial world through contacts with his clients."