Organisations representing Scotland's doctors and nurses have raised concerns over NHS vacancies.

The British Medical Association (BMA) Scotland said an "extremely worrying" number of consultant posts were vacant for more than six months, while the Royal College of Nursing (RCN) Scotland said the vacancy rate for nurses and midwives is "unsustainable".

The organisations spoke out as official NHS workforce figures were published.

The statistics show that at September 30, NHS Scotland had a total headcount of 160,897, the equivalent to 137,727.9 whole-time staff.

The figure represents a 0.8% increase in whole-time equivalent staff from the previous year.

The biggest rise was in nursing and midwifery, an increase of 515.6 whole-time equivalent staff compared to the previous year.

The number of consultants in post increased by 2.8% from September 2014 to 5,026.7 whole-time equivalent.

But the BMA highlighted a rise in the number of vacant whole-time equivalent consultant positions, up from 339 posts in September 2014 to 345 in September 2015.

There was a 22.6% increase in the number of posts that have been vacant for six months or more, up from 113 to 138.5.

Meanwhile the RCN said that despite an increase of over 500 nursing and midwifery staff since this time last year, the vacancy rate also continues to rise and is now almost 4%.

There are over 2,400 vacancies for nurses and midwives and 500 have been unfilled for more than three months.

Dr Nikki Thompson, chair of the BMA's Scottish consultants committee, said: "Official figures show that the number of vacant consultant positions is still on the rise. This is extremely worrying.

"We know that there are consultant vacancies that do not get picked up in official statistics, so the picture is very likely worse than these figures suggest.

"Consultants in post and working are vital to patient care. Jobs unfilled after months on end put huge pressure on services as remaining consultants struggle to cover the gaps.

"The Scottish Government must recognise that they have a major recruitment and retention problem, and take action to value the consultants we have, and attract those others that patients and services desperately need."

RCN Scotland associate director Ellen Hudson said: "These figures are deeply worrying.

"We know that the Government is trying to address the shortage of nurses and repeatedly says that there are more nursing staff working in NHS Scotland today, but we still have a large gap between the number of nursing staff health boards need to meet the rising demands on our health service and the nurses available to fill these posts.

"This situation is not sustainable and puts even more pressure on existing staff who are working flat out on our wards and out in the community, without enough staff and feeling unable to provide the care they would like to."

Health Secretary Shona Robison said: "Under this Government, NHS staff numbers have risen significantly, with more consultants, nurses and midwives now delivering care for the people of Scotland.

"In addition to having record staffing levels, Scotland is leading the UK in the development of mandatory nursing and midwifery workload and workforce planning tools that help health boards to plan for the number of staff they require.

"The recent rise in nursing and midwifery vacancies is due to the creation of new posts in health boards, mainly as a result of information from the workload and workforce planning tools.

"Several health boards have received additional investment to increase their nursing numbers and are in the process of recruiting these additional nurses. Additional posts have also been created across health boards to deal with winter pressures."

Ms Robison added: "The number of staff working in Scotland's NHS is at a record high, having increased by more than 10,600 under this government. This includes a record level of consultants and more than 2,000 additional qualified nurses and midwives.

"We know health boards are working hard to fill vacancies, and they are going in the right direction.

"In the quarter from June to September 2015, the rate of nursing and midwifery posts vacant for more than three months decreased by 0.2% to 0.8%, while the rate of consultant posts vacant for more than six months decreased by 0.9% to 2.6%.

"Of course, any increase in vacancies is linked to health board's efforts to increase capacity by recruiting even more staff.

"Several health boards have received additional investment to increase their nursing numbers and are in the process of recruiting these additional nurses.

"Additional posts have also been created across health boards to deal with winter pressures.

"We continue to work with health boards and ISD Scotland to design better, more consistent recording of vacancies for consultants, nurses and allied health professionals.

"We have already indicated to stakeholders, including BMA and RCN Scotland, that we will share our findings on vacancies shortly."