TOKYO — The leaders of South Korea and Japan faced a barrage of criticism on Tuesday from nationalists upset about a landmark deal aimed at resolving a dispute over Korean women who had been pressed into sexual servitude in Japanese military brothels before and during World War II.

President Park Geun-hye of South Korea and Prime Minister Shinzo Abe of Japan had long cultivated reputations as hard-liners in their countries’ recurring battles over history. While Ms. Park had demanded that Japan do more to atone for its 35 years of colonial rule on the Korean Peninsula, Mr. Abe had suggested that Japanese rule was less brutal than Koreans said it was.

In recent years, their stances had deepened the conflict but won support from professed patriots at home.

So the compromise agreement announced on Monday, in which Japan offered a new apology and $8.3 million to help care for surviving victims — in return for a South Korean promise not to press any future claims — seemed to some observers to borrow a page from the diplomatic playbook of President Richard M. Nixon. They drew comparisons to Mr. Nixon’s decision to seek détente with China in 1972, a move that was both surprising and politically feasible given his longstanding anti-Communist credentials.