BOSTON – A Brazilian man was reunited with his Massachusetts husband this week after U.S. Sen. John Kerry pressed federal officials to temporarily allow the 31-year-old gay man back into the country on humanitarian grounds.

Brazilian-born Genesio “Junior” Oliveira rejoined Tim Coco, 49, of Haverhill, in an emotional reunion at Boston’s Logan International Airport.

Gay rights and immigrant advocates declared the case a rare victory for gay, married asylum seekers.

“I’m delighted,” said Oliveira, who married Coco in 2005 in Massachusetts, where gay marriage is legal. “I’ve been waiting for this to happen. I never really undid my bags since returning to Brazil.”

Nearly three years ago, the couple split when Oliveira was forced to return to Brazil after being denied asylum in the U.S. because the federal government does not recognize same-sex marriages.

The pair maintained contact through online video chats and sporadic visits during holidays.

The case gained international attention from gay rights and immigrant advocates who criticized U.S. officials for separating the legally married couple.

Last year, Kerry asked Attorney General Eric Holder to grant Oliveira asylum on humanitarian grounds. Then in March, Kerry wrote Homeland Security Secretary Napolitano asking her to issue Oliveira “humanitarian parole” based on his fear of persecution in Brazil.

Humanitarian parole is used sparingly to bring someone who is otherwise inadmissible into the U.S. temporarily because of a compelling emergency, according to the U.S. Department of Homeland Security.

Last month, Kerry called Coco to inform him that Oliveira had been granted humanitarian parole and would be allowed to stay in the U.S. for at least a year.

“Obviously we’ll work on a permanent solution, but for right now I just couldn’t be happier that the system worked and Tim and Junior are reunited,” Kerry said. “This is a very sweet moment, long overdue, but sweeter because they decided it was worth the wait.”

Oliveira said he will again try for permanent residency in the U.S. either on the basis of his marriage or as an asylum-seeker who feels threatened by anti-gay violence in his country.

Although Brazil is one of Latin America’s most tolerant countries toward gays, a number of Brazilian gays have convinced U.S. judges to grant them asylum on the grounds they would face persecution if sent home.

Federal immigration officials held Oliveira for three hours for interrogation following his landing Wednesday in Atlanta. He missed his connecting flight to Boston and caught a later one.

“It was a very difficult journey with a lot of hopeful leads that didn’t pan out,” Coco said. “Kerry’s office never gave up. We’re glad he didn’t.”