A man who allegedly hit another man in the head with a hammer and robbed him in Culver City last week has been arrested and charged, police said Monday.

The incident occurred around 5:30 a.m. Oct. 5 while the victim was sleeping in a tent at an encampment near the 3800 block of Sepulveda Boulevard.

Responding Culver City police officers discovered the victim had been sleeping in his tent when two assailants allegedly walked in, pepper sprayed him and hit him in the head with a hammer, authorities said.

The attackers took the victim’s property and ran away.

The victim was hospitalized in critical condition for several days following the attack, police said.

Culver City detectives eventually identified a suspect who they say has an “extensive” arrest record.

A judge granted police a search warrant for the suspect at a Culver City motel room where he was believed to have been staying.

The suspect, 32-year-old Anthony Paul Yanez, was arrested on Oct. 7 on suspicion of robbery and aggravated assault.

The Los Angeles County District Attorney’s Office later charged Yanez with assault with a deadly weapon, police said.

Authorities did not release any additional information about the possible second suspect.