By Marcela Ayres and Lisandra Paraguassu

BRASILIA (Reuters) - Brazil on Monday offered its state governments 50 billion reais ($15 billion) of emergency debt relief over the next three years in an effort to shore up public services and extended an emergency loan to Rio de Janeiro before the Olympics amid the worst recession since the 1930s.

Finance Minister Henrique Meirelles announced after a meeting among state governors and interim President Michel Temer that states would receive a six-month grace period on debt to the federal government, followed by a year and a half of reduced payments.

The federal government also agreed to extend a 3 billion-real ($850 million) loan to the state of Rio de Janeiro, a source with knowledge of the situation said, confirming a Reuters report on Saturday.

The funds will be paid next week, the source said, adding that details on making the transaction were still being decided. Rio originally asked for a loan of 6 billion reais, the source said.

Rio declared a state of financial emergency on Friday and requested funds to pay for public services during the Games and the completion of a subway line needed to carry fans to Olympic venues.

Meirelles said governors agreed at the meeting with Temer on the need for separate treatment for Rio because of the Olympics and they would not follow suit in declaring a financial emergency.

DEBT RELIEF

The debt relief should give some breathing room to heavily indebted states that have struggled to pay public servants and maintain social programs.

Meirelles said the deal would cost the federal government about 20 billion reais this year and 15 billion reais in both 2017 and 2018. The accord marked a compromise between the two-year grace period requested by many states and the partial relief proposed by the federal government.

The finance minister also said governors expressed their support for limiting growth in states' public spending to the inflation rate of the prior year under a proposed constitutional amendment, the same rule proposed for federal spending.

Temer took office last month when suspended President Dilma Rousseff stepped aside to face a Senate trial on charges of breaking budget rules. She denies any wrongdoing.

He said on Twitter the deal with states also meant that five credit lines from development bank BNDES would be extended for another 10 years.

(Additional reporting by Cesar Raizer; Writing by Brad Haynes and Anthony Boadle; Editing by Cynthia Osterman and Peter Cooney)