President Barack Obama and Costa Rica's President Laura Chinchilla shake hands at the end of their joint press conference in San Jose, Costa Rica, Friday, May 3, 2013. Photo: Moises Castillo, AP Photo:

President Barack Obama and Costa Rica's President Laura Chinchilla shake hands at the end of their joint press conference in San Jose, Costa Rica, Friday, May 3, 2013. Photo: Moises Castillo, AP Photo:

SAN JOSE, Costa Rica — President Barack Obama said Friday he supports recognizing gay unions in a broad immigration bill pending in Congress but won’t say whether he would sign legislation that fails to do so.

Obama says that recognizing same-sex relationships in the bill is “the right thing to do.” But he says it would be premature to telegraph what he will or won’t do before lawmakers send him a bill.

LGBT advocacy groups are pushing for inclusion of language from the proposed Uniting American Families Act (UAFA) as an amendment to the legislation being considered for immigration reform.

But Republicans, including some who helped draft the bill, have made it clear that amending the legislation in that fashion would cost their support.

Florida GOP Sen. Marco Rubio, one of the leading sponsors of the immigration reform bill, said earlier this week that “the gay rights push threatens the immigration deal,” and Sen. Jeff Flake (R-Ariz.) told The New York Times the provision was a “deal-breaker for most Republicans.”

Obama commented at a news conference Friday evening in San Jose, Costa Rica, with President Laura Chinchilla.

Associated Press contributed to this report.