Ryan Allen Jones, 34, was ordered held on $750,000 bail.
Deputy District Attorney Steven Schott said 32-year-old Ben Vernon and 37-year-old Alex Wallbrett were among several firefighters who responded to a call of a sick man about 4 p.m. Wednesday at the trolley station in the 500 block of Park Boulevard.
Schott alleged that Jones refused orders to step away from the scene, then attacked transit officers before stabbing the two firefighters.
The prosecutor said Vernon jumped over a rail to assist the transit officers and was stabbed twice with a 3-inch pocket knife, suffering a punctured lung.
The defendant allegedly tried to stab Vernon in the head but missed, according to the prosecutor, who alleged that Jones also stabbed Wallbrett multiple times.
A fire captain tripped as he pushed the defendant over a concrete bench, prompting Jones to say, "I will kill you all," according to the prosecutor.
Transit security officers ended the assault by pulling the 6-foot-3-inch, 210-pound assailant off the victims and dousing him with pepper spray. The guards then held Jones until police arrived.
The entire incident lasted less than a couple of minutes, Schott said.
A motive for the attack was unclear, but the defendant was convicted in Oakland of battery on a peace officer, the prosecutor said. Jones also has a 2002 out-of-county robbery conviction, as well as multiple weapons convictions, Schott said.
The defendant -- who has no known address -- will be back in court July 8 for a readiness conference and July 10 for a preliminary hearing.
He faces more than 25 years to life in prison if convicted, according to the prosecutor.