The credit ratings agency Moody's has stripped Brazil of its investment grade status.

The agency is lowering Brazil's ratings by two notches, from Baa3 to Baa2 with a negative outlook. Moody's is the last of the three major credit ratings agencies to cut Brazil to junk status. Fitch Ratings lowered its rating for Brazil in December, mirroring a similar move by Standard & Poor's in September.

In a note accompanying its decision on Wednesday, Moody's says the downgrade is driven by worries over an increase in government debt "in a low-growth environment" and the country's "challenging political dynamics".

Brazil is in the midst of its worst recession since the 1930s. Last week, the central bank published figures showing that the country's economy shrank more than 4 percent in 2015.