BEIRUT - At least 10 times over the past six years, authorities from Lebanon's customs, military, security agencies and judiciary raised alarm that a massive stockpile of explosive chemicals was being kept with almost no safeguard at the port in the heart of Beirut, newly surfaced documents show.

Yet in a circle of negligence, nothing was done - and on Tuesday, the 2,750 tons of ammonium nitrate blew up, obliterating the city's main commercial hub and spreading death and wreckage for miles around.

President Michel Aoun, in office since 2016, said Friday that he was first told of the dangerous stockpile nearly three weeks ago and immediately ordered military and security agencies to do “what was needed.” But he suggested his responsibility ended there, saying he had no authority over the port and that previous governments had been told of its presence.

“Do you know how many problems have been accumulating?” Aoun replied when a reporter pressed whether he should have followed up on his order.

The documents surfacing in social media since the blast underscore the corruption, negligence and incompetence of Lebanon's long-ruling political oligarchy, and its failure to provide its people with basic needs, including security.

Investigators probing the blast have focused on personnel at the Port of Beirut, Lebanon's main port, so well known for corruption that its common nickname is Ali Baba's Cave.

So far, at least 16 port employees have been detained and others questioned. On Friday, investigators questioned and then ordered the detention of the head of the port, Hassan Koraytem, the country's customs chief, Badri Daher, and Daher's predecessor.

But many Lebanese say the rot permeates the political system and extends to the country's top leadership.

The explosion of the ammonium nitrate, after apparently being set off by a fire, was the biggest in Lebanon's history. The known death toll reached 154, including bodies recovered from the rubble Friday, and more than 5,000 people were wounded. Billions of dollars in damage was caused across the city, where many are too impoverished by Lebanon's financial crisis to rebuild.

Aoun's comments were the most senior confirmation that top politicians had been aware of the stockpile.

“The material had been there for seven years, since 2013. It has been there, and they said it is dangerous and I am not responsible. I don't know where it was placed. I don't even know the level of danger. I have no authority to deal directly with the port,” he told a news conference.

He said that when he was told of the stockpile on July 20, he immediately ordered military and security officials “to do what is needed.”

“There are ranks that should know their duties, and they were all informed. ... When you refer a document and say, `Do what is needed,' isn't that an order?” he added.

He said the explosion may have been caused by negligence, but the investigation would also look at the possibility that it could have been caused by a bomb or other “external intervention.” He said he had asked France, which has close ties to its former colony, for satellite images from the time of the blast to see if they showed any planes or missiles.

President Donald Trump said Friday that he had spoken by telephone with Aoun and French President Emmanuel Macron. He did not mention the investigation, but noted that medical supplies, food and water were being sent from the U.S., along with emergency responders, technicians, doctors and nurses.

The ammonium nitrate, a chemical used in fertilizers and explosives, originated from a cargo ship called MV Rhosus that had been travelling from the country of Georgia to Mozambique in 2013. It made an unscheduled detour to Beirut as the Russian shipowner was struggling with debts and hoped to earn some extra cash in Lebanon. Unable to pay port fees and reportedly leaking, the ship was impounded.

The first known document about it came on Feb. 21, 2014, three months after the ship's arrival. Col. Joseph Skaff, a senior customs official, wrote to the customs authority's anti-smuggling department warning that the material still on board the ship docked at port was “extremely dangerous and endangers public safety.”

Col. Skaff died in March 2017 in unclear circumstances. He was found near his house in Beirut after allegedly falling from a big height. Medical reports at the time gave different explanations, one saying it was an accident, the other saying there was unusual bruising on his face.

On June 27, 2014, Jad Maalouf, a judge for urgent matters, wrote to the Ministry of Public Works and Transportation, warning that the ship was carrying dangerous material and could sink. He said the ministry should deal with the ship, remove the ammonium nitrate and “place it in a suitable place that it (the ministry) chooses, and it (the material) should be under its protection.”

Soon after that, the shipment was moved into Warehouse 12 at the port, where it remained until it exploded. It is unclear if it was officially under the ministry's control.

Lebanon's LBC TV station reported that in October 2015, the army intervened after learning of delays in dealing with the shipment. Military intelligence sent an expert who tested the material and found that the nitrogen levels were 34.7%, considered a highly explosive level, LBC said.

The army reported to the customs department that the material should be quickly removed, suggesting it be exported. Customs referred the report back to the judge of urgent matters, LBC said.

Three military and security officials did not respond to calls and messages from The Associated Press to comment or confirm the report on LBC.

Daher, the customs department head, told the AP before his detention that between 2014 and 2017, he and his predecessor sent six letters to the judge warning that the stockpile was dangerous and seeking a ruling on a way to remove or sell it.

Daher said it was his duty to alert authorities of the danger but that was the most he could do. He said he never got a reply.

Earlier this year, State Security, after investigating the stockpile, issued a five-page report saying the material must be gotten rid of. It said the ammonium nitrate could explode and warned terrorists could steal it, saying one wall of the warehouse had a hole in it and a gate was open.

Throughout this period, Lebanon had four prime ministers, including the current one - Hassan Diab, who came to office earlier this year - as well as multiple government reshuffles. In 2013, when the ship docked, Michel Suleiman was president, followed by two years without a president as political factions wrangled, before finally electing Aoun in October 2016.

For decades, Lebanon has been dominated by the same political elites, many of them former warlords and militia commanders from the civil war. The ruling factions use public institutions to accumulate wealth and distribute patronage to supporters. A blind eye is often turned to corruption, and little development is put into institutions. As a result, power outages are frequent, trash is often uncollected and tap water is largely undrinkable.

The leader of the Iran-backed militant Hezbollah group, whose allies dominate the government, said in a speech Friday that “negligence, corruption, nepotism” had a role in the explosion and must be dealt with.

Hassan Nasrallah warned that if no one was held accountable, “we are basically saying to the people there is no state.” He also said Hezbollah's domestic opponents were trying to use the blast to stir public opinion against it but would fail. He denied any role by Hezbollah in the disaster.

Both Nasrallah and Aoun rejected calls for an international investigation.

Since last October, the Lebanese people have held mass protests denouncing the country's entire ruling elite, including Nasrallah. The demonstrations achieved only a rearranging of the names in the government, and largely faded amid the coronavirus pandemic and Lebanon's financial collapse.

In a sign of how the public has largely come to expect government inaction, thousands of volunteers have cleaned up streets in the neighbourhoods worst hit by the blast. They swept broken glass and reopened roads, helped restaurants and shops clear debris, and salvaged merchandise. They separated rubble into piles of broken glass and mangled metal. Others volunteered to go into destroyed homes to look for medicine, valuables and essential documents for the residents who fled in panic.

French and Russian rescue teams with dogs searched the port area on Friday, pulling more bodies from the rubble. Women cried nearby as they waited for news about missing relatives.

France has sent a team of 22 investigators to help investigate the cause of the blast. Based on information from Lebanon so far, France's No. 2 forensic police official, Dominique Abbenanti, said Friday the explosion “appears to be an accident” but that it's too early to say for sure.

In an interview with the AP, he predicted that the death toll would grow.