Madrid, Spain (CNN) An ice rink in Madrid has been turned into a temporary morgue as Spain tries to cope with the fallout from its rapidly spreading coronavirus outbreak.

Bodies of people who have died of Covid-19 are now being transported by the country's emergency military unit to the Palacio de Hielo, or Ice Palace, in Madrid's Hortaleza neighborhood, the Madrid regional president's office told CNN on Tuesday.

The regional government said this was a "temporary and extraordinary measure" designed to "lessen the pain of the families of the victims and the situation that's being recorded in Madrid's hospitals."

Spain has the fourth highest number of confirmed cases worldwide -- after China Italy and the US -- and the third highest number of deaths. The country has confirmed 39,673 cases and 2,696 deaths, the prime minister's office said Tuesday.

The Madrid municipal funeral service, a major provider in the city, announced in a statement on Monday it would stop collecting the bodies of Covid-19 victims, because its workers don't have sufficient protective material. The service manages 14 cemeteries, two funeral parlors and two crematoriums in Madrid.

Read More