Alan Wilson and Jim McGarry, who were working for British Pipe Coaters of Leith, died along with three fellow workers when gunmen thought to be Islamic extremists broke into their work camp in Bounoura, Algeria, early on Friday.
About 20 militants attacked as the victims slept in barracks belonging to the factory, which specialises in irrigation piping. Two Frenchmen and a Tunisian who also worked for the firm were shot dead. Three local guards hired to protect the workers were also killed.
Mr Wilson, 44, married with four children, lived in Willowbrae, Edinburgh. Mr McGarry, 46, a Canadian citizen who also lived in the Scottish capital, was married with three teenage children. They had been in Algeria for five weeks.
Around 280 British people are working in Algeria, the Foreign Office said yesterday. Most of them are based in the south, working for multinational companies in the oil industry.
A Foreign Office spokesman said: "I don't think British people are safe anywhere [in Algeria]. They have armed security but there is a civil war going on.
"We advise visitors not to go there and residents to leave if they can. If they don't, so be it but that is our advice. More than 80 foreigners have been killed there in the last 18 months.
"We are down to a minimum staff and we are keeping the situation under review."Reuse content