ALFRED — Dylan Collins, the teenager accused of setting a fatal fire in a downtown Biddeford apartment building in September, told police that he lit the fire to scare an ex-girlfriend and that the two men who died were “collateral damage.”

Collins, 18, admitted to police before his arrest in November that he and a 16-year-old girl who lived in the apartment building at 35 Main St. had broken up about nine months before he set the fire on Sept. 18, and that he had seen her kissing another man on the sidewalk in front of the building the night before he started the blaze.

The details emerged Friday after a judge in York County Superior Court ordered that a seal be lifted on an affidavit filed by police seeking a warrant to arrest Collins. He was arrested on Nov. 7 and indicted in early December on two counts of murder and two counts of arson.

He was not required to enter a plea until his arraignment on Friday, when Justice Paul Fritzsche lifted the seal after Collins appeared before him. Collins spoke only briefly at the hearing, answering yes and no to questions and pleading not guilty to the charges.

Fritzsche ordered Collins sent to Riverview Psychiatric Center in Augusta for a 60-day evaluation.

Collins purchased a lighter and rubbing alcohol, purposely paying cash to avoid a record of the transaction, that he used to start the fatal blaze that trapped roommates Michael Moore, 23, and James Ford, 21, in their third-floor apartment, according to the affidavit by state police Detective Kristopher Kennedy.

Moore died of smoke inhalation, and Ford died a month later of infections brought on by the toxic chemicals in the smoke he inhaled.

“Dylan (Collins) was aware that the stairwell he lit on fire was the only means of exit from (his ex-girlfriend’s) apartment and believed that (she) was inside the apartment at the time of the fire,” Kennedy wrote in the affidavit.

Firefighters rescued the girl and her parents from their apartment by using a ladder to reach their windows and help them to safety, the affidavit states. The girl is not being identified by the Portland Press Herald because she is a victim.

The arson and murders remained unsolved until Collins’ mother, Donna Pitcher, called police on Nov. 5 with concerns about her son’s well being.

Pitcher told Biddeford police that her son had punched holes in the walls and door of her previous apartment and smashed her computer. She also told them that she found a typed note from her son threatening to kill her and others with a gun to force police to kill him, and that he wanted to die to be “in spirit” with his ex-girlfriend, Kennedy wrote.

Collins had a loaded 12-gauge shotgun with a shortened stock concealed in a bag at the time of his arrest, Kennedy wrote.

According to the affidavit, Pitcher also showed police her son’s iPod Touch, where he kept a digital diary in which he stated he would “blow away any cop that tries to mess” with him. A diary entry, dated Oct. 27, also stated that Collins knew his arrest was imminent because he got a message from his ex-girlfriend that she had spoken about him with a detective.

“Honestly they had no leads whatsoever because I was so careful, even if (my ex-girlfriend) had said it was all circumstantial, I really wasn’t dumb about the thing honestly, I just got cocky about it afterward,” Collins wrote in the diary entry. “I didn’t mean to kill those two people. Those were collateral damage, unfortunate casualties in which I was actually trying to … scare (my ex-girlfriend), so I’m sorry they died … but I refuse to go to jail for the rest of my life because I accidentally killed two people.”

Detectives said Collins verified that he made the entries.

Collins’ ex-girlfriend told a state police detective that she had dated Collins for about two months before they broke up in December 2013 and that they had minimal contact afterward, according to the affidavit.

Collins’ mother has said that she tried repeatedly to get her son help before the fire, including one call to police that led to Collins being committed at Southern Maine Health Care in Biddeford for a month-long evaluation starting in July.

Collins appeared in court Friday with his hair brown and frizzy instead of dyed black as it was at his last court appearance in November. He appeared confused, looking to his attorney, Will Ashe, for advice before answering any questions.

Collins has been in custody at York County Jail in Alfred since his arrest, although he was transferred to a hospital for two days after apparently attempting suicide by jumping head-first off a second-floor landing at the jail on Nov. 20.

Fritzsche ordered Collins held without bail, although Ashe reserved the right to argue for possible bail at a later date.