Venezuelan President Hugo Chavez said he intervened with Iranian counterpart Mahmoud Ahmadinejad, a close ally, to secure the release of two American hikers convicted of espionage, adding that he had acted on a request from U.S. actor and activist Sean Penn.

The president said he was "very pleased" over the Sept. 21 release of Shane Bauer and Josh Fattal, who were detained in Iran for more than two years, and that he had invited the two young men to visit Venezuela because "it seems they like excursions."

"Sean Penn came here. He talked to me about these young men. He explained who they are and I, well, complying with the request of a friend like Sean Penn, knowing how serious he is, what I did was contact President Ahmadinejad directly," Chavez told reporters Thursday.

"I called him on the phone. I send him a note and I asked him to consider the situation. One must be very respectful of each country's things," the leftist president said.

"If they helped in some way, I'm pleased," he said, adding that he spoke with Bauer and Fattal a few days ago during a meeting they had with Venezuelan Foreign Minister Nicolas Maduro in New York.

"I invited them here ... since it seems they like excursions, adventures ... they were invited. It seems they're going to come," Chavez said.

"How wonderful that they're free with their families. I'm happy about that and I really thank President Ahmadinejad," he added.

Bauer and Fattal, both now 29, were arrested on July 31, 2009, along with their traveling companion, 32-year-old Sarah Shourd, while hiking in an area of Kurdistan that is the subject of a border dispute between Iran and Iraq.

The three hikers, who consistently maintained their innocence, said they got lost but at no time intended to enter Iranian territory. They said they only did so because they were called over by members of the Persian nation's border patrol.

Shourd was freed on $500,000 bail last year on humanitarian grounds.

The Iranian Foreign Ministry said after Bauer and Fattal were released that the decision was due to the intervention of several countries, including Venezuela.