PROVIDENCE, R.I. — Just before Thanksgiving, Claudio Neves Valente checked into a Boston hotel and traveled to Brown University, where he had studied physics 25 years earlier.

The drive to Providence was short, and in the days that followed, the 48-year-old Portuguese national returned to the campus again and again. On most trips, he drifted around Brown and the surrounding neighborhoods in a gray Nissan rental car with Florida plates. A custodian noticed him inside an engineering building while most students were home on the holiday break and spotted him again three days later, according to authorities.

Investigators say that on Dec. 13, Neves Valente returned to Brown once more, this time with a 9 mm handgun, and he opened fire in a lecture hall in an attack that killed two students and injured nine others. He got away in the ensuing chaos, and two days later, showed up at the home of a Massachusetts professor who was a classmate of his in Portugal in the 1990s, and fatally shot him, too, investigators said.

In their frantic search for the Brown attacker, authorities released footage in the hopes that someone might recognize him. But his face was always hidden behind a mask, with a black beanie covering his head.

“I wish the video could speak, and then I’d have the answers I need,” a frustrated Providence police chief, Col. Oscar Perez, told reporters during one of the week’s news briefings.

Arriving in New England

Investigators are still trying to figure out much of what Neves Valente was doing in New England in the weeks before the shooting, but they know he repeatedly visited the Ivy League school’s Providence campus. He was spotted on surveillance footage at a Boston rental car agency as early as Nov. 17.

Neves Valente, who attended Brown as a graduate student during the 2000-01 school year, may have arrived in Boston from Miami, the site of his last known address. He stayed at a Boston hotel from Nov. 26 until Nov. 30 and was spotted by the custodian in the Brown building twice: first on Nov. 28 and again three days later, on Dec. 1, the day he rented the gray Nissan.

On at least one occasion, the custodian saw him enter from the same street entrance that authorities say the attacker used to get in and out on the day of the shooting.

Brown is attacked

Last Saturday, he roamed the streets near campus for hours, sometimes jogging and sometimes walking with what investigators described as a distinct gait. In surveillance footage, he first appeared just after 10:30 a.m. could be seen, off and on, casing the area over the next few hours.

At about 2 p.m., a man whose tip police have credited with breaking the case open — identified in an affidavit only as “John” — saw a man authorities later identified as Neves Valente inside the engineering building. He said their encounter was in a first-floor bathroom, that the man had a “weathered” and “cinnamon color complexion,” and that his clothes were “inappropriate and inadequate” for New England in December.

It’s unclear if John and the custodian are one and the same. A Brown spokesperson didn’t respond to an inquiry seeking clarification.

John said he followed the man outside, leading to a “game of cat and mouse.” He said he saw the man approach a silver Nissan with Florida plates, click the key fob causing the lights to flash, and then abruptly turn away and start walking in a different direction, according to the affidavit.

The interaction ended when the suspect confronted him and asked, “Why are you harassing me?”

At about 4 p.m., authorities believe Neves Valente entered the engineering building through the street-facing door, walked into the lecture hall and opened fire on students who were studying for a final before slipping away.

With few if any security cameras in the engineering building, investigators were left for days with little more than blurred images pulled from home security systems and passing vehicle cameras — moments in time that show where the gunman had been, but not who he was. As police flooded Providence and warned the public that the suspect remained at large, investigators acknowledged the challenging task ahead of them, given the limited evidence on hand at the time.

Early on Sunday, FBI Director Kash Patel announced on social media that investigators had effectively identified or detained a person of interest in the Brown shooting. But authorities released that man hours later after determining he didn’t do it.

The attack near Boston

On Monday night, shots rang out in a neighborhood in the Boston suburb of Brookline. Someone had shot Massachusetts Institute of Technology professor Nuno F.G. Loureiro in his home before fleeing.

Loureiro died at a hospital the next day — the same day that Neves Valente apparently shot himself in New Hampshire, according to initial autopsy results released Friday.

Loureiro, a 47-year-old physicist and fusion scientist who ran one of MIT’s biggest labs, grew up in Portugal and studied in the same university program as Neves Valente from 1995-2000. But it would be days before investigators would link the Brown shooting and professor’s killing, saying initially that they had no reason to think they were related.

While trying to find an image of the Brown attacker’s face in the days after the shooting, investigators were also interviewing the students who were in the room when he opened fire.

When one of the wounded students was shown an image of the man in the initial grainy videos that police circulated, she froze, shook, then began to cry, overcome with recognition, the affidavit states. She said she knew immediately that the man was the one who had hurt her and her classmates.

Another victim “took a deep breath, shut his eyes, changed his breathing pattern,” before confirming that the man in the video footage was the person who shot him, it says.

But no one — including any of the victims — could provide a name or even place ever seeing Valente before the shooting.

A break in the case

On Thursday, authorities said they suspected that the same person might have been responsible for both attacks.

The tip from the man identified as John about encountering a suspicious man with a Nissan with Florida plates enabled Providence police to tap into a network of more than 70 street cameras operated around the city by surveillance company Flock Safety. Those cameras track license plates and other vehicle details.

After leaving Rhode Island for Massachusetts, authorities say Neves Valente stuck a Maine license plate over his rental car’s plate to help conceal his identity.

Video footage showed Neves Valente entering an apartment building near Loureiro’s. About an hour later, he was seen entering the New Hampshire storage facility where he was later found dead, authorities said.