People leave the Smithsonian National Zoo on Easter Monday after it was closed because of a shooting nearby. (Toni L. Sandys/The Washington Post)

The shooting outside the National Zoo during the annual Easter Monday celebration was the result of a 14-year-old gang member targeting rivals from Prince George’s County, D.C. police officials said Monday.

During an initial hearing in D.C. Superior Court, investigator Jeramiah Mendez said that the teen, who was arrested Saturday, came upon members of the rival gang standing outside the zoo, pulled out a silver handgun and fired twice into the crowd. A 16-year-old was shot in the elbow and an 18-year-old was shot in the hand. Police said both were members of the Kentland Crew of Prince George’s.

The 14-year-old, who police said is a member of the Southwest Crew of Southwest Washington, was charged as a juvenile with 13 criminal counts, including two counts of first-degree attempted murder and assault with intent to kill. He pleaded not guilty to all of the charges.

The Washington Post was permitted to attend the hearing on the condition that it would not identify the youth.

Mendez said two witnesses, including the teen’s brother, identified him as the shooter. Mendez also said that the youth, after being questioned by police, admitted to the shootings. The teen’s brother told police that the youth used a gun he found about three weeks before the shooting, Mendez said. The gun has not been found.

The teen was led into the courtroom with shackles at his ankles, waist and wrists, accompanied by officers from the Department of Youth Rehabilitation Services. At 5-foot-3, he barely reached the shoulder height of his public defender.

The middle school student has previous arrests in the District. In 2011, he was charged with robbery while armed during an incident involving a knife. Prosecutors later dismissed that case. Last year, the teen was charged with felony threats. He pleaded guilty to misdemeanor threats and was placed on a 30-day probation, which a court social service worker said was completed successfully.

The teen’s mother pleaded with Judge Lori E. Parker to allow her son to return home. “That’s my baby. If you send him home to me, I can take care of him,” she said. “His father is incarcerated, so I am the mother and the father. I pleaded with the system for help and they failed him. He needs a mentor.” The teen wiped away tears streaming down his face as he sat next to his attorney.

Parker, citing the gun charges and the teen’s arrest history, ordered the youth to remain in the custody of DYRS to “protect himself and the community.” His trial is scheduled for June 19.

Neighbors of the teen expressed surprise at the arrest. “No, not him,” said a woman who declined to give her name. “A gun? Where did he get a gun at? He’s just a regular teenager.”

The shooting occurred on Connecticut Avenue NW the afternoon of April 21, during the Easter Monday celebration and shortly after people had begun leaving the zoo in Woodley Park. Zoo security had just evicted a group of rowdy teens, who then encountered another large group of youths arriving at the main entrance.

Mendez testified that a group of about 40 teens tried to enter the zoo, but zoo security and officers refused to allow them inside. Instead, the teens congregated along Connecticut. The crowd, Mendez said, resembled a “block party.”

Based on intelligence information, authorities had been watching for violence, and some people in Southeast discussed the potential for trouble on Twitter. “They Going To The Zoo TO Fight,” read one message posted on Twitter on April 14.

D.C. police said that one youth fired a gun into the air that afternoon, a week before the Easter Monday shooting, although officials have not said whether the two incidents are connected. The week of spring break was particularly busy for the zoo, with students out of school and many visiting the attraction. The shootings have led to community meetings, promises by zoo officials to increase security and a debate over whether to continue the Easter Monday event.