SAN FRANCISCO (CBS SF) — A man claims he broke into a San Francisco apartment because he thought it was a spaceship — and it worked in his defense.

After getting into a scuffle with the people who lived at the Mission District apartment, he was acquitted of robbery and other felony charges.

READ MORE: Evacuation Warnings Issued for San Mateo County Areas Burned by CZU Lightning Complex Fire

According to his defense team, 41-year-old Santino Aviles believed the earth’s destruction was imminent, so he spotted the apartment building he thought looked like a spaceship.

He gained access to the roof by a building resident who let him inside after ringing the buzzer. He then climbed onto the fire escape and into an apartment through an open window.

After a short nap on the couch, he threw the resident’s inflatable exercise ball onto the fire escape, “planning to float with it through the galaxy,” he testified.

READ MORE: Police Investigation of Shattered Vehicle Windows Temporarily Shuts Highway 17 Saturday

ALSO READ: NASA Says We’ll Find ‘Definitive Evidence’ Of Alien Life In Next 20 To 30 Years

The resident and his girlfriend woke up find Aviles in the apartment and went after him with a baseball bat before calling 911. The resident injured his toe in the scuffle while Aviles suffered a black eye and other bruises.

In a videotaped interrogation following his arrest, Aviles can be seen muttering about spaceships and telling police the world was going to explode.

MORE NEWS: Russian River Rubber Dam Deflated Due to Impending Storm

His attorneys say he was suffering from a meth-fueled psychosis. He was only convicted of misdemeanor battery and assault.