William Shatner had an unwanted visitor outside his home Thursday night, but when the suspicious man was confronted ... he took off at warp speed before cops could catch him.
Law enforcement sources tell TMZ ... the 'Star Trek' legend was at his San Fernando Valley home Thursday around 5 PM when an adult male wearing shorts was spotted outside peering into his house.
We're told someone by Shatner's residence went to ask the guy what he was up to, at which point he began pacing back and forth ... and then bolted.
Our sources say a 911 call was made and cops showed up within 5 minutes to search for the prowler, but he was long gone. Police spoke with the OG Captain Kirk to make sure everything was fine at his place, which it was.
We're told cops have upped patrols in the area and are still looking for the guy.