Yemeni prison and interior ministry authorities had information as early as two months beforehand that al Qaeda militants were planning a prison break in the capital's main prison, documents seen by Reuters showed.
The warnings apparently went unheeded.
On February 14, armed attackers mounted a coordinated bomb, grenade and gun assault at Sanaa's central prison to free al Qaeda-linked inmates.
At least 19 suspected militants fled in the ensuing chaos. In late March a video surfaced online showing the top leader of al Qaeda in the Arabian Peninsula (AQAP) greeting escaped inmates in open celebration and vowing to attack America.
The documents related to the jail break highlight one of the biggest challenges facing Yemen in its fight against AQAP - namely a weak, disjointed and underquipped security force, which unless radically overhauled is likely to drop the ball on more major security incidents that could threaten Western interests.
Instability in U.S. ally Yemen also threatens neighboring oil power Saudi Arabia. The two countries share a long, porous border, and many AQAP militants are Saudi nationals bent on toppling the ruling al-Saud family.
In a handwritten document dated December 7, 2013, titled "Top Secret" and "Urgent and Important Message", the manager of Sanaa's central prison, Mohammed al-Kowl, addressed a letter to the head of Yemen's rehabilitation and reform department, which falls under the Interior Ministry.
"We have received information which indicates that elements of al Qaeda inside the (prison) are planning with the rest of the group outside the (prison) to try and storm the prison and release them, especially after the defense ministry was stormed," said the letter, written on the interior ministry's letterhead.
It's not clear what was the response of the interior minister at the time, Abdelqader Qahtan. But following the prison outbreak, Yemeni President Abd Rabbu Mansour Hadi had him replaced. Kowl has been detained while charges of dereliction of duty are investigated.
Kowl declined to comment because his case is still ongoing. Reuters was not able to reach Qahtan on repeated attempts.
In another document, of which a Reuters reporter in Sanaa saw a copy, Kowl said no one had responded to his requests that CCTV cameras be repaired, or that the prison be reinforced with extra soldiers and younger guards.
Reuters has not independently verified the authenticity of the documents, but has seen copies of Kowl's December 7 document as well as another December 9 document that shows the letter was seen by the public prosecutor, who wrote to Qahtan asking him to examine the concerns expressed in it.
When asked to comment about the documents, Col. Ahmed Harba, the current interior minister's press secretary, said a number of officials and the prison's security guards had been interrogated and their cases referred to the judiciary.
He did not specify the charges.
"The judiciary will decide to either convict them or find them innocent ... because the talk about a deficiency in soldiers ... is not an excuse for something like this to happen."
The December 7 memo warned that the inmates' continued presence in the prison was "a security danger, especially since the prison is in decay and would be easy to storm". It also said that the militants had spread their extremist ideology and succeeded in recruiting dozens of inmates.
Kowl said that by making this case, he was "giving up responsibility", as they had effectively run out of means to secure the prison.
Kowl requested that the inmates be moved to a political security prison or any other prison for "extremist groups". The memo came attached with a list of prisoners' names it found concerning, but Reuters was not able to see this list.
Another memo, seen by a Reuters witness, cited Kowl as saying there had been a request to reinforce guarding the prison with extra soldiers, replace some individuals whose age no longer allows them to continue carrying out guarding duties, and fixing cameras which have been broken for two years ... but no one has responded to this".
A memo dated December 9, 2013, from the public prosecutor's office and addressed directly to the interior minister, refers to the warnings made by the head of the prison.
Due to these warnings, the letter said "we found it necessary to inform you to take your measures to prevent this from happening and to present the necessary protection for the central prison and to investigate the appeal made according to the law."
The memo was signed and stamped by Ali Ahmed al-Aa'wash, Yemen's public prosecutor.
As Reuters has not been able to make contact with Qahtan, it is not clear how the interior minister responded to those memos.
AQAP leader Nassir al-Wuhayshi had also warned he would free inmates in an August 2013 statement seen on a website used by Islamists.
In a country where corruption and poor governance are part of the political fabric, it is no surprise that the security forces are less than effective.
President Hadi has restructured the defense ministry but acknowledges that more needs to be done.
"The foundations for building security are always going to be hard, and therefore the interior ministry's security cadres have to be more prepared and organized and of a high professional level," he said in a recent speech to graduates.
A senior Yemeni security official, in reference to the jail break documents, told Reuters: "Obviously there is neglect, (by the Yemeni security forces). The president changed the interior minister and fired the head of prison department, the manager of the prison and the prison guards."
Without a strong Yemeni security force - stretched thin by southern secessionists and a northern rebellion - Washington has increasingly relied on drone strikes to combat the threat posed by AQAP.
A series of air strikes on April 20-21 killed 65 militants, according to Yemeni authorities, though none seemed to be among Washington's most high-value targets - namely Wuhayshi and his mastermind bombmaker, Ibrahim al-Asiri.
Yemen's army has followed up with a major offensive in the southern provinces of Abyan and Shabwa to root out the militants from their strongholds. Authorities say dozens of militants have been killed in the fighting. On Sunday alone, Yemen said at least 37 al Qaeda militants were killed in Shabwa. The militants were of various nationalities, including Afghans, Somalis and Chechens.
Highlighting the challenges in security, a French man was shot dead by gunmen in the Yemeni capital on Monday.
AQAP's cell leader in Mahfad, the cell a Yemeni official says was the group's most active in the country in plotting attacks against the military and oil and gas facilities, was killed. Yemen said the army had taken control of a militant bastion in Mahfad over the weekend.
The effectiveness of the drone strikes is debatable. While some U.S. officials credit the program in Yemen with preventing AQAP from holding onto territory as it did in 2011-2012, some fear the number of civilian casualties has increased sympathy for AQAP.
The United States has focused much of its effort on providing counter-terrorism training for Yemen's beleaguered security forces, but it is an uphill task.
"The Yemeni security services need a lot of help. This has been well known for a long time. We have trainers working with specialized Yemeni units as we have had for years; they're trying to get them to learn how to prepare themselves to go into battle," a former U.S. diplomat familiar with the region told Reuters.
"This is still hard. There's not enough qualified people in the rank-and-file. You can't get that very small number to spread out sufficiently or efficiently enough to all the different services you're trying to work to bring them to the same level of operational skill."