SEOUL, South Korea — A letter from the Japanese prime minister to the South Korean president was refused by both governments on Thursday, as the countries’ latest quarrel over a set of disputed islets spawned a curious spat over diplomatic protocol.

The letter from Prime Minister Yoshihiko Noda was delivered to the South Korean Embassy in Tokyo last Friday, and the Japanese government published its contents online soon afterward. In the letter, Mr. Noda protested President Lee Myung-bak’s visit on Aug. 10 to the islets, known as Dokdo in South Korea and Takeshima in Japan, which lie midway between the two countries and are claimed by both. Mr. Noda also objected to Mr. Lee’s subsequent remark that Emperor Akihito of Japan “does not need to come” to South Korea on a planned visit unless he unequivocally apologizes for his country’s past colonial rule of Korea.

South Korea, which chafed at Japan’s having made the letter public before Mr. Lee could read it, decided to return the letter. “It included contents that we cannot tolerate at all,” Cho Tai-young, a spokesman for the South Korean Foreign Ministry, said Thursday. “It’s only natural to send such a letter back.”

But the Japanese government’s top spokesman, Chief Cabinet Secretary Osamu Fujimura, said it was “inconceivable for a letter between nations’ leaders to be sent back.” Later on Thursday, when a South Korean diplomat tried to return the letter to the Japanese Foreign Ministry, the ministry refused to open its gate for him, South Korean officials said. The diplomat turned back, and the embassy later sent the letter by registered mail, the South Korean officials said.