Image copyright PA Media Image caption Boris Johnson swinging on the chassis of the so-called Boris Bus at the Wrightbus plant

In 2012, Wrightbus was riding high. The company launched a new red double decker bus for London.

A fleet of the New Routemasters had been ordered by the then mayor Boris Johnson - and so became known as Boris Buses.

The new bus even had a starring role on Top Gear, racing with supercars.

It was a triumphant time for the Ballymena business, but now it's been brought low, set to fall into into administration.

Months of rumours

The company's financial stress became public knowledge in July.

It admitted it was working with business advisors Deloitte to find potential investors.

This confirmed months of rumours that had been swirling around Ballymena.

The first sign of problems could be seen in the firm's most recently-published accounts.

Image caption The launch of the new Routemaster was a high point for Wrightbus

The top company in the Wright business, the Cornerstone Group, showed the firm made a loss of £1.7m in 2017.

That compared to a pre-tax profit of almost £11m in 2016.

A note in the accounts said there was continued uncertainty in the UK market with a "challenging outlook" for all bus manufacturers.

It also said the business was facing increased material prices due to exchange rates.

That is a reference to the relative weakness of sterling since the Brexit vote, which makes it more expensive to buy components that are priced in euros or dollars.

The company's financial position has deteriorated further since then.

New premises

Wrightbus is a major employer in Ballymena with more than 1,200 employees.

It can trace its history to the years after World War Two, when Robert Wright began making body work for vans and other vehicles.

He was joined by his son William who was instrumental in transforming the business into a major bus builder.

Image caption The Wrightbus factory occupies a huge site in Ballymena

It broke into the UK market and then, under former chief executive Mark Nodder, grew its international presence.

Buses were made for customers in Hong Kong and Singapore. A joint venture was set up in India.

Just two years ago, the company moved onto a huge manufacturing site in Ballymena.

It had been vacated by the cigarette company JTI when they pulled out of the County Antrim town.

It was statement of intent by Wrightbus: "We're growing and we're here to stay."

So what's gone wrong?

Demand for new buses in the UK, the key market for Wrightbus, is weak.

Figures from the Society of Motor Manufacturers and Traders (SMMT) show that in the second quarter of this year new bus and coach registrations are down 30% compared to the same period last year.

That marks the 10th quarter in a row that new registrations have declined.

The bus market is cyclical and Wrights did benefit from a splurge of bus buying earlier this decade as operators updated their fleets to meet new regulatory requirements.

But this down part of the cycle seems particularly pronounced.

Image copyright Getty Images Image caption For all its publicity, the Boris Bus did not land any export sales for Wrightbus

SMMT chief executive Mike Hawes said: "The current climate of political and economic uncertainty, exacerbated by confusion around differing local authority requirements for clean air zones, is affecting operators' confidence and willingness to invest in the market."

And for all its publicity the Boris Bus did not land any export sales for Wrightbus.

Transport for London also stopped ordering it in 2016 as it fell out of favour with the the new mayor Sadiq Khan.

Wrightbus's efforts to break into international markets have also not been enough to compensate for weakness in the UK.

However, there is still some hope that something can be salvaged from the company's failure: Wrightbus has developed expertise in electric and hydrogen-powered buses, which are expected to be a growing part of the market.

Meanwhile, in recent years the company has paid out large donations to a religious charity, Green Pastures, which is led by Wrightbus's majority shareholder Jeff Wright.

Image caption Work at the new Green Pastures site appears to have stalled in recent months

Green Pastures received about £15m over six years, helping it to develop a huge church and village complex known as Project Gateway.

Most of this money was paid at a time when the company was making large profits.

Work at the Gateway site appears to have stalled in recent months.