Vulnerable children were left at risk of serious abuse and neglect after a breakdown in the management of a council's social work department, according to a damning official report.

Last night Midlothian Council confirmed its £82,000-a-year director of social work, Malcolm McEwan, had resigned in light of the findings.

HM Inspectorate of Education found the council's social work office lacked leadership, suffered from poor communication, and was blighted by "strained relationships" among managers.

Senior councillors also lacked a clear vision for keeping children safe, and were ignorant of the effect of staff shortages.

Councillor Danny Molloy, who had political responsibility for social work, also resigned his council cabinet post, as well as standing down as depute leader.

The report's findings were discussed by First Minister Jack McConnell and the rest of the Scottish cabinet yesterday. Hugh Henry, Minister for Education and Young People, last night wrote to the authority demanding it fix its problems as a matter of "extreme urgency".

The report follows high-profile cases of social work failure in neighbouring councils.

In Edinburgh, 11-week-old Caleb Ness was shaken to death by his brain-damaged father in 2001 after social workers felt it was safe to send him home with his mother, a recovering drug addict. In December 2005, two-year-old Derek Doran died in East Lothian after drinking methadone in his parents' home.

Drawing on live case files and interviews with families last summer, HMIe examined the way all agencies involved in child protection in Midlothian operated, including health services, police, the children's reporter, voluntary groups and the council.

Inspectors found agencies had a good record for information sharing and early intervention.

However, social work staff were "inconsistent" in following up on early work, neglect cases were not given enough priority except when they reached a crisis, and inter-agency planning was poor. As a result "the needs of many of the most vulnerable children were not always met and some children were left at risk".

Children stayed on the child protection register for "long periods" with no improvement in their circumstances.

In addition, social work record keeping was poor, and in some cases untrained social work staff were used to interview children about suspected abuse.

Confusion about handling very young babies at risk led to some not being inadequately assessed. Overall, HMIe looked at 18 indicators of service quality.

Three were at the bottom of the scale, "unsatisfactory"; 12 were "weak"; and three "adequate". No aspect of child protection was good, very good or excellent.

Mr Henry, who met council officials earlier this week to discuss a comprehensive action plan, said: "This needs remedied as a matter of extreme urgency and I expect all agencies across Midlothian to act immediately to tackle the issues and to ensure that vulnerable children are not slipping through the net. I will keep in close touch with progress and developments to be assured that all appropriate steps are taken."

Adam Montgomery, Labour leader of Midlothian, accepted the finding of serious weaknesses, but said a recovery plan was already under way. "We've made good and reassuring progress over the five months since the inspection."

Trevor Muir, the council's chief executive and newly appointed chair of the inter-agency Midlothian Child Protection Committee, said: "The HMIe process made it clear to all the agencies the extent and immediacy of the action required. I am satisfied we are on track to deliver the necessary inter-agency improvements well in advance of the reinspection."

Councillor Molloy said people should be reassured the service had improved greatly in the last five months, adding: "Social workers do a very difficult job under exceptionally challenging circumstances and this HMIe report does not challenge their professionalism, ability or commitment."

The Midlothian agencies have four months to submit a joint report outlining their progress, with a follow-up inspection within a year.