Gen. Joseph F. Dunford Jr., seen last summer in Washington, visited Cairo this weekend. (Yuri Gripas/Reuters)

CAIRO — Gen. Joseph F. Dunford Jr., the top U.S. military officer, made his second trip to Egypt in two months this weekend, a visit that underscored growing concern about Islamic State-linked militants and ongoing efforts to address friction in the countries’ military partnership.

During his overnight stay in Cairo, Dunford met with Egyptian President Abdel Fatah al-Sissi and Lt. Gen. Mahmoud Hegazy, the country’s chief of defense. It was the second time this week that a senior U.S. official met with Egyptian leaders here, following Secretary of State John F. Kerry’s earlier visit. The head of U.S. Central Command also held talks in Cairo recently.

The visits underscore the difficult balance that the Obama administration is seeking to strike with Egypt, a historic anchor of U.S. efforts to establish stability in the Middle East but whose heavy-handed, authoritarian tactics have alienated Western allies.

While U.S.-Egyptian military ties have been largely shielded from the worst of the friction over Sissi’s moves against political opponents, gaps have emerged over the safety of U.S. peacekeeping troops there and over Egypt’s approach to managing its militant threat.

A spokesman for Dunford said the general and Sissi, himself a former general who came to power after the 2013 ouster of President Mohamed Morsi, discussed the security situation in the Sinai region as part of a conversation about regional security.

U.S. officials are concerned that Egyptian security forces may be unable to keep pace with expanding activity by militants linked to the self-proclaimed “Sinai Province” of the Islamic State, one of a network of militant satellites.

The increasingly bold affiliate is the latest incarnation of a long-running insurgency in the marginalized desert region. But it has increased the scale and scope of militant activity in the Sinai, both against Egyptian security forces and foreign targets. Late last year, militants claimed responsibility for downing a Russian passenger plane over Sinai, dealing a severe blow to Egypt’s tourism sector.

U.S. officials are concerned that the violence could spill over and affect more of its approximately 700 peacekeeping troops in the Sinai, part of a multinational peacekeeping effort set up following Egypt’s 1979 peace deal with Israel. Last fall, four U.S. soldiers from the Multinational Force and Observers (MFO) were wounded by a roadside bomb.

Already the United States has moved some troops to southern Sinai, leaving about 300 U.S. military and civilian personnel at another camp in the peninsula’s more restive northern region. U.S. officials now hope to build support among Egyptian and Israeli officials for reducing the size of the U.S. contingent by replacing troops with surveillance technology. That could mean removing hundreds of troops from Egypt.

According to Zack Gold, an Atlantic Council scholar, the group, also known as Wilayat Sinai, might focus attacks on peacekeepers because of their home nations’ participation in operations against the parent organization in Iraq and Syria.

“Of the MFO 12 contributing nations, seven are also involved in the anti-ISIL coalition, and it is quite likely Wilayat Sinai will act against the MFO as a response to coalition operations in Iraq and Syria,” he said, using an acronym for the Islamic State.

Although Egypt already has launched military operations against militant targets in Sinai, U.S. officials believe they need a more targeted, counter-insurgency approach that would be likely to gain support of Sinai residents and prove more sustainable.

But U.S. officials say that many Egyptian leaders have resisted American efforts to prompt changes in their Sinai strategy, preferring to stick to their use of American-funded weaponry such as the F-16 and Apache attack helicopter.

“The Egyptian military wants U.S. arms, but it bristles [at] constructive advice as to how best to use them in its current confrontations,” Gold said.

The United States has long provided about $1.3 billion in annual military aid to Egypt. The Obama administration temporarily suspended some military aid following the military’s 2013 ouster of Morsi, and it has introduced some reforms that aim in part to tailor aid to modern challenges.

A spokeswoman for the Egyptian Embassy in Washington did not immediately respond to a request for comment.