The deputy first minister was accused of “creating a turf war” with Scottish councils by demanding they maintain teacher numbers in return for government money.
John Swinney said cash was on the table as long as local authorities “signed up to a clear commitment to protect teacher numbers”.
However, he threatened to clawback the funds from any council which failed to keep to the agreement.
The ultimatum sparked an angry reaction, with councils claiming they would be punished for no fault of their own if they failed to attract recruits.
Moray Council has warned that pupils may have to be sent home unless an acute shortage of teachers is resolved. It has been unable to attract suitable candidates for some posts despite spending £35,000 on advertising.
Mr Swinney used his budget speech to attack the local authority umbrella group Cosla for failing to agree to a “fair and generous offer” of government support.
He said the government “has no alternative” but to make the £41million from April available on a council by council basis if they signed an agreement to protect teacher numbers.
“However, let me be clear any council which does not make that commitment and demonstrate that it can be achieved will have their share of the £41million clawed back before April,” he said.
A further £10million would be available to councils that signed up to the commitment after the December teacher census, he said, but a failure to deliver would “result in a further clawback of funding”.
Conservative finance spokesman Gavin Brown accused Mr Swinney of using his budget speech as a platform for “creating a turf war with Cosla”.
“We heard talk today of claw-backs, of penalties, of ring-fencing, yet just a few months ago, the first minister in her programme for government said that this would be a great decentralising government,” he said. “What was decentralising about today?”
Anne Skene, chairwoman of Moray children and young people’s services committee, called his comments “ironic” in the face of the council’s problems.
“We can make the commitment to teacher numbers but if we can’t recruit the teachers we will fail in our commitment and that will be extremely difficult to bear considering that we have already taken several measures to recruit teachers here…and so far we have not been successful,” she said.
North-east Labour MSP Richard Baker said: “John Swinney’s threat to penalise councils for failing to meet targets on recruiting teachers will only make the situation worse for Aberdeen and Aberdeenshire. He has failed to realise the specific challenges our councils face in recruiting staff to an area with such high costs of living and house prices.”
Larry Flanagan, general secretary of the EIS teachers’ union, slammed Cosla’s attitude considering the “near 10% reduction” in teacher numbers over the past decade.
“It seems that, despite Cosla’s repeated statements about its commitment to protect education, their objective is to slash education budgets and cut teacher numbers even further – with serious consequences for pupils across Scotland,” he said.
Cosla president David O’Neill said he was “outraged and appalled” at Mr Swinney’s actions as there had been constant contact with the government over the past 10 days and yesterday the deputy first minister was told a leaders meeting had been called for Friday.
“Local government is a statutory service provided by councils and this is a blatant attempt by government to control it by making these decisions,” he said.
“We have consistently argued that focusing on teacher numbers won’t deliver the improvements in attainment that we all desire. The best people to take decisions on education work in councils not in St Andrews House.”
Liberal Democrat education spokesman Liam McArthur said: “Whilst the SNP pick a fight with councils in the run up to the general election it is our schools and pupils who are caught in the middle.”