A suspect in a series of shootings this month targeting homeless men in New York and Washington was arrested early Tuesday, the police in Washington said. At least five men were shot, two of them fatally.The suspect, who was not immediately identified, was arrested in Washington, the city’s Metropolitan Police Department said. “He is currently being interviewed at our Homicide Branch,” the department said in a tweet. “Thanks to the community for all your tips.” The police had offered $70,000 for information that led to an arrest and conviction.The extended shooting spree prompted an intense search across both cities. The authorities said the man shot three men sleeping outdoors in Washington between March 3 and March 9, and two men in Lower Manhattan on Saturday. One victim in each city died. The New York Police Department said in a statement Tuesday after the arrest that the investigation remained active. “Great teamwork on the part of the Washington D.C. Metropolitan Police Department, the New York City Police Department, the Bureau of Alcohol, Tobacco and Firearms and the Federal Bureau of Investigation.”On Monday, the mayors and police officials of both cities had pleaded for help finding the gunman. In New York, investigators searched homeless encampments with outreach workers, looking for others whom the gunman might have targeted, law enforcement officials said, and distributed fliers with pictures of a suspect. And they searched block by block for people sleeping on the streets, encouraging them to move into shelters for their own safety.Many questions about the gunman remained unanswered, including why he targeted people living on the street.Authorities said they connected the cases after a police captain investigating the killing of a homeless man in Washington saw a photo on social media of the suspect in the New York attacks. Ballistics analysis confirmed on Sunday that the same gun was used in all five shootings, according to the Bureau of Alcohol, Tobacco, Firearms and Explosives.In each of the shootings, a lone gunman dressed in dark clothing targeted homeless men between midnight and dawn. The first three attacks were in Washington, in the city’s Northeast section. One man was shot on March 3 and another on March 8. On March 9, a man was fatally shot and stabbed and his tent was set on fire, the Metropolitan Police Department said.The gunman struck again in Manhattan early Saturday, shooting two men, one fatally.The police have not released the names of the victims, about which few details are known.The shootings come at an anxious moment for the thousands of people who live unsheltered in New York City. And the come several weeks into a campaign by Mr. Adams to remove people who shelter in the subway system. Advocates for homeless people had warned that the effort would push many people to the street who refuse to stay in the city’s barrackslike group shelters, which they find rife with crime and interpersonal conflict.In interviews in both cities before the arrest, several homeless people said they were unnerved by the attacks, but not enough to move indoors.“Listen, the streets are dangerous,” Marty Mercer, 51, said near his tent in the makeshift campground in front of Union Station in Washington on Monday as commuters hurried by. “Just because someone is doing this on a serial basis is no different.”Andy Newman and Ashley Southall contributed reporting.