An armed father in Tennessee confronted a suspected sex offender at his daughter's bedroom window, authorities have said.

Justin Kyle Phelps, 26, was arrested following his alleged attempt to climb into the bedroom of a 13-year-old girl he had met on Facebook, according to police.

Phelps, of Knox County, is accused of using social media to pose as a teenager and lure minors into sexual activity.

Knoxville Internet Crimes Against Children Task Force agent Chris Jones told the Knoxville News Sentinel that the mother of the 13-year-old girl had spotted someone attempting to climb in through her bedroom window and frightened them off.

But just hours later, Phelps allegedly reappeared and attempted to get into the room a second time. But this time the girl's father, who was holding a gun, was waiting inside for him.

"The victim's mother stated that the offender fled the scene again and did not return," Jones said.

A psychological evaluation of Phelps has been ordered by assistant US attorney Matthew Morris. He said there was "reasonable cause to believe" that the accused may not be fit to stand trial.