CAIRO — Held incommunicado for the four months since his overthrow as president, Mohamed Morsi of the Muslim Brotherhood walked into a makeshift courtroom on Monday for his new role as a defendant in a murder trial.

But Mr. Morsi, dressed in a blue suit, refused even to wear the usual all-white prisoner’s costume.

“I want a microphone so I can talk to you,” Mr. Morsi shouted three times from a special defendant’s cage constructed to obscure him from public view. “There is a military coup in the country,” he shouted, adding, “I am the president of the republic, according to the Constitution of the state, and I am forcibly detained!”

Repeatedly cited by the new government as evidence of its adherence to the rule of law, the trial instead threatened to embarrass its leadership, with the defendants and their lawyers seizing a rare platform to question the military takeover. Islamists around Egypt were galvanized by Mr. Morsi’s show of defiance as the judge failed to gavel him into silence and instead adjourned the trial for two months.

And the timing, analysts said, also proved awkward for Secretary of State John Kerry. On a visit to Cairo just a day before, he had said that — despite a series of mass killings of protesters, the shutdown of opposition news media outlets and apparently politicized trials like Mr. Morsi’s — “there are indications” that the generals who ousted Egypt’s first freely elected president intended to restore democracy.

Image

The Egyptian police arrested a supporter of Mohamed Morsi, the former president, during a protest in Ramses Square on Monday in Cairo.CreditMohamed El-Shahed/Agence France-Presse — Getty Images

The visit was “unbelievable timing,” said Michael Wahid Hanna, an Egypt scholar at the Century Foundation in New York. He argued that opponents of the Islamists would see the trip as an American effort to protect Mr. Morsi, while Islamists would hear Mr. Kerry’s “soft and optimistic statements as a U.S. blessing to the new military-led political order.”

It was the second criminal prosecution of an ousted Egyptian president in the same venue within less than three years. But in a reversal of the dynamic during the live broadcast of Hosni Mubarak’s trial in 2011, on Monday the hearing quickly devolved into a tug of war over just how much attention Mr. Morsi could receive.

“Mubarak was hiding from the cameras, and now they are hiding the cameras from Morsi,” said Emad Shahin, a political scientist at the American University in Cairo, who called the new government’s rush to trial “a miscalculation” because “this will increase the perception of him as a hero, an icon for the resistance.”

Ahmed el-Arainy, 42, a Brotherhood organizer, called the opening of the trial “a good day.”

“They just wanted to show him shaken in a cage, a defendant in prison clothes, but, God bless him, he stood in defense of his cause and not theirs,” he said. “What is on trial is the country, and its will to change,” he added.

Along with 14 Islamist allies or presidential staff members named as defendants, Mr. Morsi was charged with inciting the murders of at least three protesters. If convicted, any of the defendants could face the death penalty.

Image

Thousands of Morsi supporters gathered outside the Court in Cairo on Monday as the ousted president stood trial.CreditAmr Nabil/Associated Press

Only six of his fellow defendants appeared in court with him, including the prominent Brotherhood leaders Essam el-Erian and Mohamed el-Beltagy.

Journalists were allowed into the courtroom, but they were barred from bringing cameras, recording devices or telephones, so that Egyptian state news media was the only one to control audio or video clips.

Many of the Egyptian journalists who were allowed inside the trial chanted repeatedly for Mr. Morsi’s execution.

Rights advocates said the most serious charges appeared both selective and difficult to prove. All involve a bloody night of street fighting last December between thousands of Mr. Morsi’s Islamist supporters and their opponents outside the presidential palace.

In the nights before the deaths occurred, increasingly aggressive protesters had begun encircling the presidential palace — some throwing firebombs over its walls. But the police refused to protect the palace. (Police leaders now boast that they never obeyed Mr. Morsi.) So on Dec. 5, leaders of the Brotherhood publicly called for the president’s Islamist supporters to do the job themselves, by force if necessary.

Image

A Mohamed Morsi supporter waves a flag that reads "No to the coup" outside the Supreme Constitutional Court in Cairo.CreditAmr Nabil/Associated Press

Hundreds of Islamists arrived that afternoon and forcibly evicted a small encampment the protesters had set up near the palace but without causing significant injuries. By nightfall, thousands of Islamists had streamed in to defend the site.

After dark, thousands of Mr. Morsi’s opponents marched to the palace to retaliate against the Islamists. A night of street fighting ensued, and thrown rocks, firebombs and gunshots were flying from both sides.

Eight of Mr. Morsi’s supporters were killed, and no one has been charged in their deaths. Mr. Morsi and his co-defendants are accused of ordering the killing of three non-Islamists who died on the other side of the fight, though the identities of the killers remain unknown.

A lawyer for Ahmed Abdelatty, who worked as an administrator for Mr. Morsi and was also charged with the murders, noted in court on Monday that many Egyptians had been killing one another without any encouragement. “How can you say that the office manager of the president of the republic is responsible for the death of this person or that person?”

But the prosecutors insisted that the defendants were guilty of “premeditated murder.”

“They had the intention and the determination to murder anybody who would stand in the way of the dispersal of the sit-in,” prosecutors said, reading charges.

Video

Egyptian state television showed video of Mohamed Morsi arriving for his trial on charges of inciting murder — the deposed president’s first public appearance since being removed from office July 3.CreditCreditEgyptian State Television, via Associated Press

Other allegations involve abuses that took place as the street battle raged on. Mr. Morsi’s supporters captured, beat and interrogated dozens of his opponents. In the morning, the Islamists sought to turn them over to prosecutors, expecting criminal charges for assaulting the palace. But the prosecutors immediately released them.

Prosecutors said Monday that they would also charge Mr. Morsi with conspiring in those detentions.

Thousands of opponents of the military takeover demonstrated in two locations near major courts in Cairo, and thousands more demonstrated in other cities. Clashes with the police and several injuries were reported in Alexandria.

Islamist-led demonstrations against the takeover have continued at least weekly in most cities around the country. But on Monday those in Cairo appeared to be dispersing by the time that trial came to a close in the early afternoon.

At 1:35 p.m., a cheer rose up outside the court as a helicopter lifted off to transport Mr. Morsi from the trial, in a police academy auditorium. He was taken to a prison in Alexandria, Egyptian state news media said.

State news media reported that for the first time, Mr. Morsi was being treated like an ordinary prisoner, forced to submit to the standard admissions checkup and wear the standard prison jumpsuit.

By nighttime, state television was broadcasting a short, silent video clip of Mr. Morsi in a defendant’s cage. The website of the flagship state newspaper, Al Ahram, reported the diagnosis given by a psychologist that Mr. Morsi’s refusal to wear prison clothes suggested “attempts to deny reality,” suggesting “he is unable to bear the pain of loss and failure.”

Another said that his smile “shows the weakness of his self-confidence,” according to the newspaper, while the applause of his supporters demonstrated “the rigidity of their thought, because they only do what they are told.”

A version of this article appears in print on , on Page A1 of the New York edition with the headline: Egypt’s Ex-President Is Defiant at Murder Trial. Order Reprints | Today’s Paper | Subscribe