LAKEWOOD — A 25-year-old township man is in custody after hitting two officers with a knife and prompting an hours-long standoff from his home, according to Lakewood Police.

On Saturday after 7 p.m., two officers responded to a report of an argument in the area of Lisa Robyn Circle. A township resident then flagged down the officers and said her adult son had begun acting erratically while she and a friend were in the living room.

The woman brought the duo and a third police officer to her home, where they knocked on the bedroom door of Stanley Williams.

Police said that Williams opened the door and immediately began hitting two of the officers in the face and head with what appeared to be a knife, as the officers decided to exit the home as backup arrived.

The Lakewood Police Department Special Response Team tried to get Williams to come out of the home, but he did not.

Hours later, around 2:30 a.m., the team assisted by Ocean County SWAT entered the home and found Williams sitting on a staircase, holding what police said appeared to be a handgun, before he went back to his room.

Williams ignored calls to come out, according to police, who said they then launched pepper spray rounds through a third-floor bedroom window, after which he came out unarmed and was arrested.

Police said they found a foot-long, smooth-edge knife that was used to strike two officers, as well as what had appeared to be a firearm that Williams had been holding which was found to be a pellet gun.

Williams has been charged with attempted murder of two police officers, aggravated assault on a police officer and counts of weapons possession.

He was taken to the Ocean County Jail pending a detention hearing.

New Jersey residents charged in Jan. 6 Capitol riot (in alphabetical order)

LOOK: Here are the 25 best places to live in New Jersey

Stacker compiled a list of the best places to live in New Jersey using data from Niche. Niche ranks places to live based on a variety of factors including cost of living, schools, health care, recreation, and weather. Cities, suburbs, and towns were included. Listings and images are from realtor.com.

On the list, there's a robust mix of offerings from great schools and nightlife to high walkability and public parks. Some areas have enjoyed rapid growth thanks to new businesses moving to the area, while others offer glimpses into area history with well-preserved architecture and museums. Keep reading to see if your hometown made the list.