The deadly bombings of two churches have left Egyptian President Abdel-Fattah el-Sissi grappling with the question of how to defeat a tenacious Islamic State insurgency that three years of warfare have failed to crush.
He's also trying to repair a broken economy, carrying out tough austerity measures that have won praise from economists but have sent prices soaring.
El-Sissi must juggle these tasks while fending off criticism of human rights violations and growing authoritarianism, all with an eye to presidential elections due in 14 months.
One thing he has going for him, he hopes, is strong support from US President Donald Trump.
The security forces have largely succeeded in keeping the insurgency contained in northern Sinai, away from the heavily populated Nile Valley. Thousands of troops backed by tanks, fighter jets and helicopter gunships have been deployed in the area bordering Israel and Gaza.
But the militants are adapting and finding new ways of hitting back, shattering frequent claims in the pro-government media that the insurgency is on its last legs.
Though the militants have been unable to control territory, they carry out sudden attacks in north Sinai towns to show they can operate with relative impunity. They have shifted from suicide car bombings against security forces and instead have grown more effective at planting roadside bombs.
IS has made clear Christians are now a target. A series of killings of Christians in north Sinai sent members of the minority community fleeing across the Suez Canal to the city of Ismailia for refuge.
The aim appears to be in part to embarrass el-Sissi by exposing holes in security. The church bombings show that IS has been able to plant small cells of fighters in Egypt's heartland, a scenario that could prove disastrous for the country's stability and economic prospects.
They also stoke political tensions. Christians have been strong backers of el-Sissi since, as army chief, he ousted Islamist President Mohammed Morsi and the Muslim Brotherhood in 2013. The attacks push the community more toward the president but also stoke anger among Christians that the government is not doing enough to protect them.
The bombings and the ensuing state of emergency only further undermine efforts to revive Egypt's tourism industry, an engine of economic growth that has been severely damaged by the turmoil of recent years.
El-Sissi has sought to dismantle a decades-old contract that allowed Egyptians to buy cheap food items, fuel and a range of services in return for their loyalty. He knew the serious risks, particularly the potential for popular unrest, but still went ahead, a show of courage that his predecessors always balked at.
Fuel subsidies have been partially lifted and charges were hiked on electricity and water. Late last year, he took the boldest step, launching harsh austerity measures in return for a vital $12 billion loan from the IMF. The Egyptian pound was floated, sending its value tumbling.