(Updates with strike ending, number of deaths)
By Silvio Cascione
BRASILIA, April 17 (Reuters) - A police strike ended on Thursday after unleashing a surge in violent crime in Brazil's third-largest city just two months before it is due to welcome hordes of soccer fans for the World Cup, authorities said.
At least 39 homicides were committed during the two-day strike in and around the northeastern city of Salvador that added to fears about Brazil's ability to ensure public safety during the global soccer tournament.
Violence swept the city after state police went on strike on Tuesday night to demand better pay and other benefits, prompting the federal government to dispatch troops to restore order in Salvador and nearby towns.
Local media reported looting at supermarkets and stores, leading shop owners to close their businesses in a city that is one of Brazil's most popular tourist destinations.
A coastal city of about 3.5 million people, Salvador was the first colonial capital of Brazil and is home to some of the country's most famed Carnival celebrations. Its heritage is rich with Afro-Brazilian culture, a draw for many foreign tourists.
While Salvador has one of the highest crime rates in Brazil, during the 48-hour absence of police on the streets the city's murder rate soared far above the average 2.5 deaths a day reported a year ago.
This is not the first time that the Bahia state police have gone on strike before a high-profile event to press their demands. In 2012, a police strike on the eve of Carnival unleashed a similar crime wave that left more than 100 people dead over a 12-day span in the greater Salvador area.
President Dilma Rousseff, who has dispatched federal troops to reinforce security in some of the 12 cities that will host World Cup games, said on Wednesday that her government will deploy "heavy" security to ensure the event is not disrupted.
She said the military will be used to deter and contain violent protests.
Salvador will host six World Cup matches, including a quarter final and a high-profile clash between defending champions Spain and the Netherlands. Portugal and world player of the year Cristiano Ronaldo will also take on Germany there. (Reporting by Silvio Cascione; Editing by Todd Benson, W Simon and Lisa Shumaker)