One night in October 2018, he said, he was jolted from his slumber by a thud, followed by another. Startled, he leapt outside and grabbed a knife. A college student, walking by with a friend, had kicked Matos’ box because he thought it was trash, investigators said.

What happened next could send Matos, 57, to prison for more than a decade. Matos faces assault charges for stabbing one of the men and slashing the other, but he is fighting the case with an unusual argument: His lawyers say he was defending his home against attackers.

Under New York’s “castle doctrine,” a person has a right to protect his home with deadly force if he reasonably believes another person is entering without permission and is seeking to commit a crime. The defense hinges partly on whether a collection of cardboard boxes is a home.

(BEGIN OPTIONAL TRIM.)

The case highlights the vulnerabilities — and responsibilities — of thousands of men and women who live on New York’s streets. An estimated 3,600 people make their homes outside, a number that has not budged substantially in recent years.

A murder spree of homeless men in Chinatown last fall renewed attention on that population. On an early October morning, a 24-year-old man with a history of mental illness and drug addiction bludgeoned four homeless men to death with a heavy metal bar. A fifth man was critically injured.

(END OPTIONAL TRIM.)

The Manhattan district attorney’s office declined to comment but said in court papers that Matos had vengeance, not safety, on his mind when he confronted the students.

Prosecutors said Matos was the instigator, chasing after the young men, stabbing one of them in his shoulder and back, lacerating his liver, and slashing the other above the eye.

Matos said the kick was the first aggression. “I didn’t do anything wrong. They should be prosecuting those two guys,” he said in an interview.

Matos faces as many as 22 years in prison if he is convicted of assault charges at a trial, which has not yet been scheduled. His lawyers say he has never been charged with a violent crime before. He was arrested in 2015 for marijuana possession.

The district attorney’s office declined to name the students, but a law enforcement official identified them as Jorge Morales and Jose Bosch, who are from Guatemala and attend college in Boston.

The night of the stabbings, Morales was highly intoxicated, court papers indicated: He had a blood alcohol concentration of 0.30, almost four times the legal limit of 0.08 that is generally established for safe driving. He and Bosch were visiting New York and looking for a strip club and late-night pizza when the incident occurred, according to the documents.

In an interview with The New York Times, Morales said he was about to turn 21 and was out celebrating with friends. He said he remembered drinking beer and vodka and looking for pizza but could not recall searching for the strip club.

“I was pretty drunk, so I don’t remember some stuff,” said Morales, now 22. “Jose told me I kicked the box where he was sleeping, and that’s the reason he got mad.” Morales spent his birthday in the hospital.

Bosch did not respond to requests for comment.

Matos tells a different story. He said he had been surprised by what he thought was an assault near his head and had believed he was under threat. Standing shoeless, he grabbed a knife he used to cut twine and tape from the cardboard boxes, ready to protect himself.

He told investigators that the men returned and confronted him, with one of them bumping into him. “When he goes past me, he rubs his shoulder at my chest like, like, ‘You ain’t nothin’,’ and like, ‘Yes, so what?’” Matos told investigators.

Video footage from the scene showed Matos quickly sliding out of his cardboard structure, but the kick to the box near Matos’ head and the clash with the two students occurred out of the camera’s range. Prosecutors argue that the footage shows the boxes rattling once, not repeatedly.

Morales said he was not certain what had happened. “It was probably only once, and I don’t think I kicked it hard,” he said, adding that he could not say for certain whether he believed at the time the box was simply trash. “But I probably would not have done it if I thought someone was there.”

Matos, a native New Yorker who likes to wander south to Florida and Mexico during the winter months, was held on Rikers Island for about six months. After he replaced his court-appointed lawyer with Ron Kuby and Rhiya Trivedi, lawyers who are known for taking on challenging cases, an anonymous donor posted his $100,000 bail.

The district attorney’s office has argued in court documents that Matos’ box did not meet the legal definition of a home because it was “not a permanent structure with walls and a roof.”

Matos’ previous lawyer also failed to mount a timely argument that Matos was protecting his dwelling and was justified in using deadly force, the office said. Even if his box were considered a home, Matos was outside and acted after the men walked past him, the office said in court documents.

According to the office, Matos admitted to investigators that he could have walked away and never said he thought the two young men were armed.

If the case goes to trial, Matos’ lawyer could request jury instructions from the judge to address whether Matos was obligated to retreat or whether he could stand his ground reasonably believing he was in his home and did not have to run from it, said Carl Bornstein, a former state and federal prosecutor who teaches at John Jay College of Criminal Justice.

As someone who was constantly wary of the dangers of living on the street, Matos could have reasoned that the two men would hurt him, Bornstein said. “This seems to be a close question with a viable defense and a set of social circumstances that are tragic from start to finish,” he said.

(STORY CAN END HERE. OPTIONAL MATERIAL FOLLOWS.)

But Matos also seriously injured Morales, which a jury would take into consideration, Bornstein said.

A sentence of 22 years would be too harsh, Morales said, but he added: “I do believe he should be in jail some time.”

Matos has declined to take a plea deal and said he wants the charges dismissed. He said he had been living on the streets since about 2002, after dropping out of the Manhattan School of Music, where he studied percussion, and doing stints in the Navy and in construction, overcoming a cocaine addiction.

Since he was released from Rikers, he has set up camp on the front steps of Christ Church at the corner of East 60th Street and Park Avenue. It is about six blocks away from where he used to arrange his boxes under the awning of a hair salon on East 56th Street, where the altercation occurred.

He works seasonally for Jairo Hernandez, a building superintendent in the Bronx who said he had known Matos for more than 20 years. “He doesn’t steal. He doesn’t use drugs. He doesn’t drink. He’s a good guy,” Hernandez said.

Like many people who live on the street, Matos’ daily schedule is based on the operating hours of more than a half-dozen soup kitchens.

After an employee of Christ Church wakes him up at about 6 or 6:30 a.m., Matos folds up his boxes and carries them to the median on Park Avenue, hiding them under bushes. Then he walks to a public gym, where he can shower and store his belongings in his locker.

The Rev. Amandus Derr, the senior pastor at Saint Peter’s Church, said he had known Matos for at least 15 years as a regular at the church’s Tuesday morning breakfasts.

Derr joined other people in a video in support of Matos. In the video, he said Matos often acted as a mediator, intervening when people with mental illness who perhaps have not taken medication or are frightened by a noise become unruly.

“Joe helps calm people down, and he’s done that for a long time,” Derr said.

This article originally appeared in The New York Times .