Patients and staff were evacuated from St Andrews Community Hospital in the early hours of this morning after a car smashed into the building and burst into flames.
The Audi was embedded in the wall and both the vehicle and building were on fire after the 2am incident.
As the blaze was brought under control, those in the hospital were moved to another area of the complex.
No-one was hurt in the drama but police said it was a frightening experience for patients.
A 27-year-old-man was later traced at a nearby address and taken into custody.
He will appear at court at a later date in relation to road traffic offences.
The section of hospital used by GP services is said to have suffered significant structural damage and IT services have been lost.
Services are likely to be affected for several weeks, although staff are working to ensure continuity of care.
Sergeant Pat Turner of St Andrews police station said: “It was extremely fortunate that the part of the building with which the vehicle collided was not being used at that time.
“But this incident had the potential for much more serious consequences.
“This was undoubtedly a frightening experience for hospital residents but staff and emergency services initiated established protocols which resulted in the safe evacuation of all patients and staff.”
An NHS Fife spokesman confirmed the incident happened in the GP practice area, which was not in use at the time.
No patients or members of staff were injured.
A number of patients had to be relocated from the inpatient area for a short time while fire services dealt with the blaze but were returned to their wards once it was considered safe to do so.
The spokesman added: “We would like to reassure our patients and members of the public that while there has been significant damage to an area of the building, our patients and staff are safe.
“We have put in place contingency plans to ensure the continued provision of high quality care and we are working to return services to normal as soon as possible.
“Inpatient care is unaffected and wards should be contacted in the usual manner.”
He added that GP services will continue to be provided and patients with planned appointments should report to the main reception.
For new appointments and other GP-related services, patients are asked to use existing contact details.
All other areas of the building are open as normal.
He added: “This situation is under regular review and further information will be made available in due course.”