SEOUL, South Korea — South Korea on Friday adamantly rejected an American request to continue sharing military intelligence with Japan, as the two American allies remained locked in festering disputes over trade and history.

Mark T. Esper, the United States secretary of defense, visited Seoul to attend an annual defense meeting and personally implore his South Korean counterpart to remain in the intelligence-sharing pact with Japan, known as the General Security of Military Information Agreement, or GSOMIA.

Washington considers the agreement important for the security and stability of the region. South Korea and Japan face similar threats from North Korea and China, but there is a deep-seated mistrust rooted in Japan’s colonial rule of Korea from 1910 to 1945.

“The only ones who benefit from the expiration of GSOMIA and continued friction between Seoul and Tokyo are Pyongyang and Beijing,” Mr. Esper said during a joint news conference with his counterpart, Jeong Kyeong-doo, on Friday.