An ember that prosecutors say may have drifted from a San Marcos teen's backyard to spark last year's devastating Cocos Fire could be at the center of the girl's arson trial.

Attorneys debated in court Tuesday whether an ember from a branch the girl tried to light on fire could have floated close to half a mile to spark the blaze that ripped through nearly 40 homes last May.

The teen suspect, who is charged with four felonies and was just 13 when she was arrested, is accused of setting a tree branch on fire in her backyard. That fire, prosecutors say, left behind an ember that floated away to cause the Cocos Fire.

Prosecutor Shawnaysa Ochoa said that last May, the girl had used a lighter to set a fire in her backyard and laughed when she told her sister about it.

The next day, prosecutors say, the girl posted photos of the Poinsettia Fire on Facebook. She then went into the backyard to set a second fire on a bigger branch and did not tell her mother, prosecutors said.

An ember from that fire traveled more than four-tenths of a mile from the backyard and sparked the Cocos Fire, which torched dozens of homes and businesses, Ochoa said.

"Her willfulness was demonstrated through her planning, her clear intention through her actions," the prosecutor said. "Her maliciousness was established by starting a second fire less than 24 hours after the first fire, and doing so with a bigger branch, she told the detective. All these actions she took on May 13, 2014, will show her actions were willful and malicious."

The teen suspect's defense attorney McGlinn said that "phantom ember" could not have spread to cause another fire.

"We're talking about a phantom ember, a magic ember, one ember, which happened to travel .44 miles and cause one spot fire in the canyon," McGlinn said in court. "Not multiple spot fires, just one spot fire in this canyon."

McGlinn said he was glad there were photos presented as evidence in the trial.

"We are lucky that we have photos from people are the scene, far away, close, of what the fire looked like what the smoke looked like," he said.

San Marcos' fire chief Brett Van Wey testified that in his 29 years as a firefighter, he had seen embers travel to start other fires, especially in dry weather conditions.

But in his opinion, he added, it was a spot fire from the Washingtonia Fire that caused the Cocos Fire.

"Because of the amount of smoke and direction of smoke from the Washingtonia fire where I witnessed, and by the time I drove and saw smoke from Cocos, there was no other source," Van Wey said. "It was in direct line of the smoke."

The accused teen's parents previously turned down prosecutors' offer of a plea deal last month when she appeared in juvenile court. That deal would have required her to admit responsibility for one count, plus the allegations; the DA's office told NBC 7 the teen's parents and attorney did not accept the offer.

The girl faces four felony charges, including two counts of arson of an inhabited structure or property in which multiple structures were burned and two counts of arson of a structure or forest land in a reckless manner. She also faces a misdemeanor of unlawfully allowing a fire to escape from one’s control.

The fire that sparked near Village Drive and Twin Oaks Road in May 2014 forced the evacuation of Cal State San Marcos and hundreds of other homes. It scorched 1,995 acres and cost the city of San Marcos approximately $10.4 million in damage and firefighting expenses.

Officials have set up an information line for victims, where they can call for basic info on the case and leave messages with questions. That number is 858-694-4241.