The intruder crept into a Springfield townhouse after midnight, took a 5-year-old girl from her bed and then sexually assaulted her in a lightly wooded area nearby, police said.

Now, police have arrested a suspect in the Aug. 27 crime they called “horrific.” He is a 16-year-old from the Springfield area.

The teen, who was already in custody on an unrelated burglary charge, was arraigned Thursday in Fairfax County juvenile court. A prosecutor said in court that authorities would seek to have the teen tried as an adult because of the seriousness of the charges.

Fairfax police spokesman Bud Walker said the attack was not random, but declined to elaborate. The Post does not generally identify juveniles accused of crimes.

On Aug. 27, the assailant broke into the townhouse in the 7000 block of Brocton Court, went upstairs and took the girl from her bed, police said. The girl’s parents and a 1-year-old sibling were home at the time. Police said the parents did not realize that the girl had been abducted until she returned home about 4 a.m. and told them what had happened.

Police said the child had been taken to a wooded area that abuts her home and assaulted. After the attack, the girl was taken to a hospital and treated for upper-body injuries.

The teenager was charged with object sexual penetration, abduction with intent to defile, aggravated malicious wounding and burglary with intent to commit a felony, police said. He was arrested Aug. 31 in connection with the Aug. 24 burglary of a home in the 5800 block of Accomac Street in Springfield, police said.

“That’s when he came to the attention of investigators,” Walker said.

The arrest has relieved community residents, who had been warned after the abduction to make sure their doors and windows were locked. Tanveer Ahmed, the father of a small child, said he installed a home alarm system after the girl’s abduction.

“We have peace of mind,” Ahmed said in front of his home. “[The abduction] was sad news, because we have a 5-year-old boy.”

The juvenile court is required to conduct a hearing on whether there is probable cause to try the teen as an adult on the most serious charge: aggravated malicious wounding. Prosecutors may also seek to charge the teen as an adult on the other counts.

A woman who was identified in court as the suspect’s mother declined to comment on the teen’s arrest and arraignment.

Police said the teen is being held at the Fairfax County Juvenile Detention Center. A preliminary hearing in the case is set for Oct. 6.