Zaire Kelly was returning home from a college prep course and was less than 300 feet from his front door when authorities said a man tried to rob him along a footpath in a small park in Northeast Washington.

The 16-year-old Zaire — a standout high school senior and track athlete — used a pocket knife to defend himself Wednesday night, D.C. police said, and stabbed the attacker in the abdomen. Police said the would-be robber had a gun and shot Zaire once in the head.

They died 10 minutes apart at the same hospital in Northwest Washington.

Police identified the assailant as Sequan Keyleo Gillis, 19, who had been freed from jail two weeks ago to await trial on a charge he took a vehicle without permission, and he had been wearing a court-ordered GPS ankle bracelet to track his movements.

Zaire had just started his senior year at Thurgood Marshall Academy, a charter school in Southeast Washington, where he excelled in the classroom and on the athletic field. He was pondering what colleges to apply to, had wanted to major in chemistry and was considering running for senior class president.

Zaire Kelly, 16, was killed Sept. 20 in Northeast Washington. He was a standout high school senior and track athlete. (Family photo)

His teachers at the school, with just a few hundred students, said he sat up front, answered questions, led discussions and challenged himself by taking on the most demanding projects.

“His promise and his growth were remarkable,” said Richard Pohlman, executive director of Thurgood Marshall Academy, which Zaire entered as a sophomore.

He was then known for his nonstop talking that distracted him from his studies. But by his junior year, Pohlman and two teachers said, Zaire was focused on getting into college. On Wednesday, a teacher said, he skipped basketball practice to attend a college prep course, where he honed his SAT skills and got help with work from his advanced placement classes.

“He always had a smile and a handshake,” Pohlman said.

Wednesday night’s incident occurred shortly before 9 p.m. in a small green space at a confluence of streets — 13th, Downing and W — in the Brentwood neighborhood. The scene was along a broken red-brick path in front of a park bench under a clump of trees and next to a fence separating a public works yard.

It’s a few hundred feet from where Zaire lived, and one-third of a mile from Gillis’s residence, although police said the two did not know each other.

Relatives for Gillis could not be reached; his attorney in his pending criminal case said he did not know him well enough to comment.

The robbery occurred half a mile from where 17-year-old Jamahri Sydnor, a Woodrow Wilson High graduate, was fatally struck by a stray bullet in August as she drove along Saratoga Avenue NE days before she was to enroll in college in Florida. And it occurred four days after another 16-year-0ld, MyAngelo Starnes, was fatally shot in Southeast Washington. He attended Ballou High.

A common theme emerged on social media amid the anger and sadness over Zaire’s death — classmates promising to honor him by pushing themselves to excel in school. “I swear on my life this senior year will be greatness at [Thurgood Marshall] for you bruh,” one wrote. “You were the light and soul.”

D.C. Police Chief Peter New­sham said Zaire tried to defend himself in the robbery and stabbed Gillis several times before Gillis shot him. Zaire collapsed where he had been shot; Gillis stumbled 100 feet down an alley before falling to the ground. Police said he still had the gun.

Authorities said they believe Gillis held up Zaire at gunpoint, prompting a scuffle, but they don’t know for sure when he took the weapon out. It was not immediately clear how detectives pieced together details of how the incident unfolded.

“This is a tragic occurrence,” Newsham said. “Bullets don’t care how old you are, they don’t care who you are.”

Zaire’s family did not want to talk on Thursday.

The teenager enrolled at Thurgood Marshall, which organizes its program around justice issues, as a sophomore.

Christina Camps, who taught him algebra last year, said that “he was very energetic” when he first started at the school. “He was getting to know the school and our rules.” But, she added, “He was a totally different person when he walked in to my classroom. He was mature. He was doing his work and he was asking questions. He was a role model.”

His teachers said his grades improved as he set his sights on college, perhaps in Florida, to study chemistry. He wanted to go into the forensic sciences.

Camps, who mentored him this year, said that by his senior year, teachers “wanted him to take their class.”

Every student must present a project at the end of the year, and the first one Zaire attempted, “he didn’t do too well,” Pohlman said. For his next one, he requested teachers with reputations for harsh grading to be on the panel. “He shined,” Pohlman said.

Zaire also took advantage of a school program and got tutored by lawyers at the Foggy Bottom law firm of Vinson and Elkins. The program offered Zaire a chance to mingle with legal bigwigs who could help him polish his college applications and expose him to the corporate world.

Elizabeth Krabill McIntyre, an associate in the firm, described Zaire as animated but focused. He was one of the few students who knew what he wanted help with and was organized in his studies.

“He wanted to be here,” Mc­Intyre said.

Liza Enrich, Zaire’s chemistry teacher, said Zaire had friends throughout the high school campus. “He would always interact and didn’t shy away,” Enrich said. “He was super personable. He told me, ‘I want to be engaged.’ ”

Camps said Zaire often stopped by her office after school, where he “talked every now and then about life, his school, his dreams.”

Keith L. Alexander, Drew Gerber and Magda Jean-Louis contributed to this report.