During World War II, Japan operated a ring of spies made up of members of Spain's diplomatic delegation to the United States.

The Japanese set about organizing the spy ring three days after the Dec. 7, 1941, attack on Pearl Harbor and financed the first months of its operation with $500,000 left in a wall safe when the Japanese were forced to vacate their embassy in Washington, D.C. The Spaniards occupied the Japanese embassy and represented Japan's interests in the United States after war broke out.

The spy network was controlled from Madrid and was code-named "TO," the Japanese word for "door." The United States learned of its existence by breaking the supersecret Japanese diplomatic code, but no attempt was ever made to break up the ring for fear of tipping the Japanese that their code had been broken. The code, it was felt, yielded far more vital war information than the TO spy ring ever supplied to the Japanese.

The existence of the TO ring and its operations in the United States during World War II are described in 30,000 pages of declassified documents just turned over to the National Archives by the National Security Agency. In the documents are the decoded versions of the messages Japanese diplomats were sending to Tokyo from all over the world, unaware that U.S. intelligence was reading them at the same time the Japanese foreign office was.

The only apparent overt U.S. move against the TO ring was on April 6, 1943, when its leader and the former Spanish foreign minister were assaulted in a park in Madrid. Japan's minister to Madrid cabled Tokyo that the two men were attacked on American orders.

"On April 6 Serrano Suner (the one-time Spanish foreign minister) and the chief of the 'TO' net were assaulted by two ruffians while walking in El Retiro Park and narrowly escaped with their lives," he cabled. "The lads were apprehended and confessed that the American embassy had asked them to kill the two gentlemen. The Spanish government, for the time being, is keeping this matter strictly sub rosa, but is conducting a thorough secret investigation."

The identity of the leader of the TO ring is never revealed in the documents released to the archives. Nor are the names of the spy ring's members in the United States except to note that there were "at least six and probably eight" spies working for TO throughout the war.

All but one are identified as a Spaniards. The military attache in the Spanish embassy in Washington is identified as a member of the ring. So are the consults in New Orleans, New York and San Francisco, all port cities where information on the sizes and departures of ship convoys was vital to the enemy during the war.

A late arrival to the TO net is a Frenchman who was assigned to the Spanish consulate in Vancouver, where he reported on ship movements going north to Alaska's Aleutian Islands. The Aleutians were occupied by the Japanese in the early part of the war and were retaken by the United States in 1943.

While the released documents do not reveal how the TO spy ring helped the Japanese effort during the war, they show that its members supplied Japan and its German allies with vital information.

Once in 1942 the TO ring member in New York passed on the size (66 ships) and departure time of a convoy leaving for Europe. The information immediately was passed by the Japanese to the Germans, whose submarines then infested the North Atlantic.

Another time, the TO member in San Francisco relayed the departure time of a convoy bound out of the bay for the Aleutians. In neither case do the documents reveal whether German or Japanese submarines intercepted the convoys at sea.

Frequently, information on U.S. war production and deployment of troops and machines was sent to Madrid by the TO network. The recipients of the information in Madrid were the Spanish head of the TO ring and Japan's minister to Spain.

The TO net told Japan that the United States was training 50 Australians, Hindus and Filipinos as spies to be dropped behind Japanese lines in Sumatra, Burma and the Philippines. "Their special training," said a cable from the TO agent in Washington, "is taking place in a bungalow near the Naval Observatory."

Apparently, the TO ring had informants in the United States who were paid for their information. No names are mentioned in the documents, only occupations.

"Information in the TO reports has been attributed to the following sources," the documents say, "A major in the office of the chief of the air branch: a U.S. officer who recently returned from Australia; an Army man in the Air Force headquarters; a certain officer of the Air Defense Command; and instructor at the Merchant Marine School in New London; the manager of a Scranton munitions factory and a supervisor of floating piers in New York."

Even though the United States never tried to break the ring for fear of revealing its knowledge of the codes, Japan suspected several times that its codes had been compromised. Each time suspicion surfaced, it appeared in the coded messages the United States was breaking.

On May 26, 1943, Japan's minister in Madrid cabled Foreign Minister Shigemitsu in Tokyo: "It is strange how quickly the U.S. finds out about matters. I wonder if Japanese codes are safe." Shigemitsu replied: "I have studied the matter from a number of angles but I cannot believe that it is a result of their having solved our codes."

Later that same year, the Italians said the American spies had stolen the Japanese codebooks from Japan's embassy in Lisbon, Portugal. Shigemitsu asked his minister in Madrid to investigate and the minister responded by infiltrating Japan's embassy in Lisbon with one of his own men.

The Japanese ambassador to Portugal discovered the infiltrator and threatened to commit hara-kiri. His staff threatened to resign, denying that any theft had taken place. The matter was dropped.

Besides members of Spain's diplomatic corps, the TO ring included at least three Spanish newspaper correspondents, at least two of whom were in Washington and who were apparently free to travel about the United States. The documents go on at length in telling how all three correspondents mixed in coded and secret information with their dispatches to Spain.

Payment of the TO network was in American currency smuggled into the United States in the Spanish diplomatic pouch. The Spanish ambassador to the United States carried money to the United States with him to pay the TO ring each time he returned from a visit to Spain. Each time a new agent entered the United States, he carried money to finance his colleagues.

A fascinating but unresolved detail about the financing of the TO network appears in the documents under the heading of "Mikimoto pearls."

Two pouches of pearls were sent by the Japanese to Buesnos Aires to help pay for the TO net in the United States. They were supposed to be carried from Buenos Aires by a TO agent to New Orleans, then to the Spanish ambassador in Washington who was to arrange for their sale. The pearls were never sold by the ambassador because they apparently never made it to Washington.

The Japanese never came right out and blamed the Spaniards for the disappearance of the pearls but from their cables it is clear that is where their suspicions lay. But during a trip back to Madrid, the Spanish ambassador appeared to put the blame on the Argentines who acted as go-betweens in the would-be transaction.

The Japanese minister in Madrid cabled Tokyo: "When I was talking to (the Spanish ambassador to Washington) about the pearls, twice his eyes narrowed and he said musingly, ponderingly and in a soft, half-questioning voice to: "Investigate tactfully Argentina's reasons for failing to send a congratulatory telegram on the emperor's birthday.'"