The suspect in two fecal attacks was taken into custody Friday at a Brooklyn homeless shelter. View Full Caption NYPD

MANHATTAN — The man who randomly crammed a woman's pants full of feces and threw excrement at another woman's face earlier this week was arrested in a Brooklyn homeless shelter and charged Friday with assault and forcible touching, police said.

Detectives tracked down Ekwan Hill, 42, at 2 a.m. at the Samaritan Village homeless shelter in Bedford-Stuyvesant, and apprehended him just days after he was recorded on a surveillance video pushing a bag of poop into a woman's pants, pulling off a pair of latex gloves and fleeing the scene, according to Chief of Detectives Robert Boyce said.

A Department of Homeless Services officer at the shelter Hill was staying at recognized Hill from the video released on Wednesday, and called police, Boyce said.

Once police officers arrived, they searched Hill's locker and found it filled with many latex gloves and an Adidas T-shirt that matched the one Hill wore the day of the attacks, Boyce said.

When they showed Hill surveillance video of the attacks, he told officers, "that's me," and asked for a lawyer, Boyce said.

Hill, who has not yet been arraigned, has 21 priors, including assault and criminal possession of marijuana charges, police said.

It's not immediately clear how long Hill had been a resident of the shelter. DHS and Samaritan Village did not immediately return calls for comment on Friday.

Hill's first attack took place roughly 4:25 p.m. on Monday, when he hurled feces at a 33-year-old woman, hitting her in the face and torso, in front of 67 E. 91st St., police said. He fled the scene toward Park Avenue, according to authorities.

Hours later, at about 6 p.m., he came up behind a 27-year-old woman walking on East 74th Street near First Avenue, grabbed her waist, pushed a bag of poop into her pants and smeared it onto her butt, NYPD officials said.

It wasn't immediately clear why he attacked the women, but police believe they were randomly targeted.