A French engineer kidnapped by Islamist militants in northern Nigeria has told the BBC how he managed to escape two weeks ago.
Francis Collomp, 63, said he had studied the daily routine of his captors, and locked one in a bathroom as he was preparing to pray.
He said he then flagged down a motorcycle taxi and asked the driver to take him to a police station.
Mr Collomp was seized by the Ansaru group while working on a power project.
He was kidnapped on 19 December last year by armed men who attacked the residence of his employer, the French wind turbine manufacturer Vergnet, in the north Nigerian state of Katsina.
Ansaru, a militant group linked to the Islamist Boko Haram movement, said it had carried out the abduction.
Speaking to the BBC World Service Newsday programme, Mr Collomp said his chance to escape came when he was transferred to Zaria city in Kaduna state.
"The big difference is that in this new villa there was not only myself but also a small bathroom. One of my captors was also using the same bathroom every day for his prayers. So he would come and after a while I was just taking record, taking notice of all his moves, his times, his routines. And I decided the best opportunity would be at the evening prayers. And one night he just forgot to close the door. He started washing in preparation for his prayers. I managed to grab the keys there.
"I took my bag, I locked my captor inside as he was washing. And just to cover the noise of the keys I coughed two times while I was locking him in this small bathroom. And then, because there's this other door leading to the rest of the villa and then to the terrace, I escaped that way. I went to the streets, I ran for 400, 500 metres, got to the road, and then on the road I tried to calm down and to walk slowly, not to attract attention. And finally, because I spoke a few words in Hausa, I grabbed a motor taxi. And I said 'baraawoo, baraawoo' (which) in Hausa means thief, and I asked this guy to take me to the police.
"I said to them: 'Look, I was kept by Ansaru people. They could come any time to this place and kill us all so you'd better take some steps.' And then higher commanders came. They brought in reinforcements. Then I was taken away, eventually to Kaduna. And for the first time I could sleep on a proper mattress and have a proper shower."
"The attackers used heavy weapons. I heard four shots of a Kalashnikov, probably the four shots that killed the policeman and my security guard. I shut down the electricity, I tried to hide. They were wearing military uniforms. For some time I thought it might have been the army. Then I realised it was not... They let me guide them out of the villa but then they took me in a car. I was sandwiched between two men and they covered my face with a big, supermarket plastic bag. And I estimate they took me for about 60km. They took me to Kano."
He said he had learned the identity of his captors when he was asked to record a video message, using a script in which the name of Ansaru was stated.
Mr Collomp was watched in turn by up to 25 men, and only allowed to go to the toilet once a day, using a plastic bucket. But he said he was not treated violently, and that the pain was more psychological than physical.
"But I have to say I had a serious health problem, intestinal problems. I asked my captors to bring me medication, which they did, which of course makes me think that they wanted me to stay alive."
During his time in captivity, Mr Collomp was allowed to listen to radio services such as Radio France Internationale, which were broadcast in French and Hausa, allowing him to pick up a knowledge of the language spoken by his many of captors.
"I managed to communicate and write a few words of Hausa now and then, which was a big surprise to my captors when they realised that."
"I wanted to stay fit, so I used to walk inside the cell, and to run inside the cell, about 15 kilometres a day. And also I had to keep my mind afloat. And to do that, I was thinking about my engineering projects. I was working on how to improve electric batteries for electric cars."
Mr Collomp said he was left distressed by a message broadcast on Radio France Internationale by his wife on the occasion of their wedding anniversary.
He determined to escape after being told by his kidnappers that negotiations involving his possible release had failed. But, half in jest, he said that one of the other sparks that encouraged him to seek a way out was the food he had to endure during nearly a year in captivity.
"The food was so appalling in that place, because it was either rice or pasta. Sometimes they would mix the two together so it was so awful that I convinced myself I had to run away."