In the year before Qari Naib blew himself up on Nov. 12 inside a NATO base near Kabul killing four Americans, Afghan intelligence warned the US military at least twice that a worker could be planning an attack, government and security officials said.
The Afghan officials also said they repeatedly asked Western forces to share information about local employees at the vast Bagram air base in order to check for "suspicious people among them", but were refused.
When asked about the information sharing, NATO spokesman Captain William Salvin said NATO forces "routinely partner with ANDSF (Afghan National Defence and Security Forces) on all elements of security, to include information sharing.
"We maintain a strong, day-to-day working relationship with our Afghan counterparts but due to operational security we do not get into specifics about what is shared."
According to Afghan authorities, the US military was cooperating closely now.
"After this attack, American forces have agreed to share that information about their Afghan workers with us," said Wahid Sediqqi, the governor's spokesman for Parwan province where the sprawling, heavily fortified base is located.
Authorities subsequently discovered that Naib, a known Taliban militant before undergoing a government de-radicalization program, was using a fake name, Qari Enayat, at work.
Many intelligence leads turn out to be false and it is not clear whether better coordination would have unearthed Naib's true intentions in time to prevent him killing two US soldiers and two contractors and wounding at least 15 others, in one of the worst assaults on US forces for years.
But the first attack inside one of NATO's most secure bases has raised questions about Western forces' screening of local workers and about program designed to reintegrate insurgents into society.
The insider attack has also further complicated operations in a country where the Afghan Taliban , al Qaeda and, more recently, a local offshoot of Islamic State, are inflicting heavy casualties and making more territory unsafe.
Since the Bagram attack, the base has been in near-lockdown, with few Afghan workers now permitted inside.
Only 200 of an estimated 3,000 Afghans are believed to be allowed to return to work for now, police in Bagram said.
Until Nov. 12, Naib would have been seen as a success story for Afghanistan, which has tried to turn militants away from the stubborn insurgency that is bent on toppling the government and ridding the country of foreign troops.
"He was a former Taliban ... working inside the base for a long time, gained their trust, and based on that trust he carried out this attack," said Sediqqi.
In early 2012, after signing up for the reintegration program, Naib enrolled in a nine-month course at the Korean Vocational Training Center inside Bagram base, learning English, computer skills and how to fix cars.
Like most students at the center, Naib was offered a job straight away.
After going through security checks, including finger prints and biometrics to make sure he was not involved in past crimes, Naib started working for Texas-based Fluor Corp (FLR.N) as a car mechanic at the base, members of his family told Reuters on a recent visit to his modest home a short walk from the base.
Fluor Corp. said he was hired by one of its subcontractors.
"Fluor does not directly employ Afghans at Bagram," the company said. "Furthermore, screening and vetting of employees follows a process prescribed by the U.S. government. We follow this process and require our subcontractors to do the same."
Naib, who was in his mid-20s, worked the night shift from 5 p.m. to 6 a.m., originally earning around 20,000 afghanis ($300) a month. In March, he received a pay rise bringing his monthly salary to 30,000, his mother, Gulalai, said.
According to his family, his supervisor was "very happy" with Naib and trusted him, giving him food and drinks to take home to his parents and four siblings, whom he alone supported.
On Nov. 11, the evening before the attack, Naib left the house for work at 4 p.m. as usual, and "a loud explosion" was heard the next morning, Gulalai recalled, speaking in her dead son's room.
She also urged authorities to release his body so that he could be buried.
U.S. and NATO officials are investigating how Naib was able to breach the base's rings of security, which include numerous checkpoints and body scanners.
Afghan police have detained Naib's father and a cousin as part of their investigation into the attack.
The Afghan Taliban claimed responsibility soon after the bombing, saying the assailant was one of their fighters and that they had been planning it for four months. A spokesman declined to discuss Naib's case further.
It is not known why or when the soft-spoken mechanic rejoined the Taliban, or if he ever really left.
Bagram base, protected by concrete barriers and barbed wire fences and home to around 14,000 coalition soldiers and contractors, has come under attack before, mainly from rockets launched by militants outside, but never from within.
Five years ago, Naib had been a suspect in one of those rocket attacks, Afghan security officials said, forcing him to go into hiding for days to avoid arrest.
But the authorities never found any evidence linking him to the crime, and his mother said he was innocent.
"My son was an angel at heart. He was not guilty at all," Gulalai said.
To clear his name and prevent future police harassment, village elders recommended that Naib join a reintegration program that promised education and jobs.
Around 11,000 militants have joined such schemes, but it is unclear how many remain peaceful. A US government watchdog recently said the program had not led to a "significant diminishment of the military capacity of armed opposition."
The government has documented 154 participants that have returned to fighting, but officials privately say the actual number is much higher.
Some Afghans remain wary of American involvement in their country, and, while opposing militant violence, see foreign troops as a part of the problem, not a solution to it.
"Even if he has blown himself up, he has killed and wounded Americans," said a relative of Naib, who declined to be named because of the sensitivity of the matter.
"He has not hurt any Afghans."