Egyptian President Abdel Fattah al-Sisi told media on Thursday they should prevent defamation of the military, which he warned would be seen as "high treason" amid a campaign to crush Sinai jihadists.
Sisi's comments at a ceremony to inaugurate the "New El Alamein" city in western Egypt come after complaints by authorities against foreign and local media coverage of the campaign in Sinai.
Government rebukes to media have increased ahead of a presidential election this month that Sisi is expected to win easily, with him facing only one other candidate who until recently was one of his most vocal supporters.
"It is not appropriate that they (the military and police) be defamed and we will not allow it," Sisi said in a speech broadcast live on television.
"I hope the media helps us confront that without me repeating this demand," he said.
"This defamation will be met with the law. It constitutes, for me, high treason."
But Sisi did acknowledge that authorities should allow more media access to front lines to "see how (soldiers and policemen) are dying."
The military says it has killed scores of Islamic State group jihadists in the offensive since February 9, and at least seven soldiers have died.
It was not immediately clear to whom Sisi was referring, but his comments come after human rights group Amnesty International said the military has used banned cluster bombs in the campaign.
Some media also reported that the operations in Sinai had caused food shortages for residents of the northern part of the peninsula and civilians have been harmed by stray strikes.
A military official told AFP that the army has provided food and supplies to the residents.
"The armed forces have distributed goods to the residents... in coordination with the ministry of supply and (North Sinai) governorate has supplied them with all goods in short supply," he said.
"The operations there are ongoing, in that one is destroying the infrastructure for the extremist elements and targeting them in some residential areas without harming civilians," he said.
AFP has not verified a civilian casualty toll, and much of the military operations appear to be taking place far from residential areas.
- Ultimatum -
Sisi gave the military a three month ultimatum in November to end IS attacks, which have killed hundreds of soldiers, policemen and civilians.
The deadline came after suspected IS gunmen massacred more than 300 worshippers at a north Sinai mosque.
The former military chief, who overthrew his predecessor Mohamed Morsi after mass protests demanding the Islamist's resignation, vowed to "eradicate" extremists when he won his first election in 2014.
He faces little opposition in the March 26-28 election with most of his rivals having been sidelined, or in the case of a former army chief of staff, detained.
Sami Anan was detained shortly after announcing his candidacy in January, with the military accusing him of illegally campaigning while still a registered reserve officer.
His aide Hisham Geneina was jailed after saying in an interview that Anan had documents that could prove damning to state officials. The journalist who conducted the interview for the Huffington Post's Arabic website was also arrested.
On Wednesday, Egypt's prosecution warned it would monitor media and social media for "false news" and take legal measures against "news and rumours that harm public safety."
The warning came after the government's State Information Service, which regulates foreign media, demanded the BBC retract a report on rights abuses in Egypt.