CAIRO - Egypt's president, in his first use of legislative powers he wrested back from the army this month, issued a law on Thursday to bar the detention pending trial of defendants involved in offenses related to the media, an official said.The announcement by President Mohamed Morsy came hours after a court ordered the detention pending trial of the editor-in-chief of an opposition newspaper on charges of insulting the president.The decision may go some way to deflecting criticism that the Islamist president, who took office on June 30, has cracked down on media that is opposed to his rule."In the first use of legislative power, President Morsy issue a decree with a law not to allow temporary detention in crimes related to the press," presidential spokesman Yasser Ali told Reuters.On August 12, Morsy dismissed top generals who had led a military council that ruled Egypt after the fall of Hosni Mubarak last year and he also cancelled a decree the army had issued that gave it legislative powers in the absence of parliament.The army, based on a court order, had dissolved the Islamist-led parliament shortly before issuing the decree that was seen as a bid to rein in Morsy's role.Morsy's move to scrap that order gives him both executive and legislative powers. Opponents have accused him of concentrating too much power in his hands.State prosecutors filed charges against two journalists last week, including Islam Afifi, editor-in-chief of Al-Dostour daily, a vociferous opponent of Morsy and his Muslim Brotherhood. A criminal court ordered Afifi detained on Thursday, pending trial over accusations of insulting Morsy.Judge Mohamed Shahin told the court that the case would be adjourned to September 16.Speaking by telephone to Reuters after that ruling but before Morsy's legislation was passed, Afifi described the detention order as a "real test" and asked "every apparatus of state to stand against attempts to suppress and silence voices".In what critics said was an act to stifle the press, one edition of Al-Dostour was confiscated this month, though some copies still hit the newsstands. The paper is owned by the head of the liberal Wafd party, a group that pulled out of an electoral alliance with the Brotherhood.Morsy drew further criticism when the Islamist-dominated upper house of parliament, which was not dissolved, appointed new editors to several state newspapers. Though this had been common practice under Mubarak, critics said Morsy's allies should not have followed the same practice in the new Egypt.