Egyptian President Abdel Fattah al-Sissi attends a military academy graduation ceremony in Cairo. (Ahmed Fuad/AFP/Getty Images)

Secretary of State John F. Kerry arrives in Cairo this weekend for talks with senior officials of a government that has restricted civil liberties in the name of national security as it fights violent extremists allied with the Islamic State.

Kerry’s attendance at Sunday’s strategic dialogue, the first between the United States and Egypt since 2009, is the latest step toward mending relations that were frayed after a military coup in 2013 overthrew the elected president, Mohamed Morsi of the Muslim Brotherhood.

After Cairo, Kerry heads to Qatar to try to line up support for the Iran nuclear deal from Persian Gulf countries wary of Iran’s expansionist ambitions and to discuss ways to counter its influence in the region.

In Cairo, Kerry’s mission is to walk something of a tightrope, simultaneously showing support for the government’s campaign against militants on the Sinai Peninsula and disapproval of its increasingly repressive measures against political opponents, human rights activists and the media.

Kerry’s presence reinforces U.S. backing for Egypt’s campaign against militants linked with the Islamic State. They have infiltrated Egypt from neighboring Libya, and are fighting an insurgency in Sinai along Egypt’s border with Israel and Gaza. Kerry arrives just one day after the United States delivered eight F-16s, the first installment of a $1.3 billion military aid package that resumed in March after being suspended when Abdel Fattah al-Sissi seized power. He subsequently was elected president.

“We’re deeply concerned about the developments in Sinai,” said a senior State Department official, who spoke on the condition of anonymity under State Department rules for briefing reporters. “One of the key areas and one of the key decision points of why we decided to move forward was our estimate that the Egyptians were facing a very serious threat from ISIL-affiliated organizations in the Sinai and that we needed to help them and support what they’re trying to achieve there,” he said, using an abbreviation for the Islamic State.

Israeli military officials have threatened to attack the militant group known as the Sinai Province if it launches any cross-border attacks. Long active on the Sinai, the group rebranded itself and pledged allegiance to the Islamic State late last year.

But Kerry also is expected to raise human rights issues and argue that repression is driving some Egyptians into the ranks of the extremists.

Bipartisan groups of senators, scholars and activists sent three letters to Kerry in the past week urging him to emphasize human rights and political overhauls and the central role they play in combating Islamist groups.

The controversy surrounding Kerry’s attendance at what once was a routine meeting between allies underscores how much the political climate has changed since the revolutionary wave known as the Arab Spring spread across the Middle East.

Hopes that Sissi would head a transition government until democracy could be restored have faded in the country that sees itself as the cultural and intellectual capital of the Arab world. Sissi has made fighting terrorism a top priority, amid mounting attacks by militants against police, government targets, embassies and tourists.

According to Human Rights Watch, at least 41,000 Egyptians have been arrested since Sissi took office, many of them ordinary protesters or people suspected of links to the Muslim Brotherhood. Courts have sentenced at least 670 people to death in political cases. Under a 2014 law, people involved in nongovernmental organizations that receive foreign funding for the purpose of harming Egypt’s “national interest” or “unity” can be sentenced to life in prison.

Many innocents have been ensnared in the crackdown, as was documented in the State Department’s human rights report in June. It described security forces killing demonstrators and torturing suspects, as well as disappearances and arbitrary arrests.

Some scholars argue that the level of political repression is unprecedented in modern Egyptian history.

Human rights advocates say the State Department has soft-pedaled its criticism of the government, and Egypt may be expecting more of the same during Kerry’s visit.

“What al-Sissi wants is to show the United States continues to look at him and his policies as a way to fight terrorism and maintain stability, to continue providing aid at levels we have been, and look the other way,” said Daniel Calingaert, executive vice president of Freedom House, a group promoting human rights and democratic change.