A bus driver has been ordered to drive to a police station in Londonderry with a bomb on board.
A masked man boarded the bus in Ballymagroarty estate at about 18:45 GMT on Wednesday and ordered the driver to go to Strand Road police station.
The bus driver drove a short distance to Northland Road, got her passengers off the bus and called the police.
Dissident republicans have been blamed for the bomb which police said could have "caused death or serious injury".
The device was placed in a large bag behind the driver's seat.
It is believed up to 10 passengers were on board the vehicle at the time.
Ch Supt Stephen Cargin said the bus driver was told that the bomb had been fitted with a two-hour timer.
He said that she drove a short distance to a place she "believed was a safe part of the road" before alerting police.
"We were then able to put into place an evacuation. We evacuated around 40 homes. These people were out of their homes for up to nine hours on a wintry, cold night," Mr Cargin said.
Army bomb disposal officers examined the object in the bag and found that it was a small but viable explosive device.
"I'm sure, where it was located behind the driver's seat, it could've caused serious injury or death to the driver or the other people on the bus," Mr Cargin added.
"The driver is extremely traumatised as you can imagine," he said.
"There were nine to 10 passengers on the bus at the time. Again I'm sure they're all reflecting on what could have happened last night."
Mr Cargin added that there could have been "dire consequences" if the device had exploded.
Northern Ireland Transport Minister Danny Kennedy praised the "bravery" of the bus driver.
"The driver showed immense courage under very difficult circumstances," he said.
"Attacks on public transport impact the entire community who depend on buses and trains to get to work, school, hospital and go about their daily business," he added.
Secretary of State Theresa Villiers said: "The people who put a viable device on a bus last night engaged in an act of extreme recklessness and intimidation.
"Their clear intention was to cause injury and the potential death of innocent people.
"The driver should be commended for her tremendous bravery under horrendous circumstances."
The bus driver works for Translink, Northern Ireland's public transport company.
Translink spokesman Ciaran Rogan said: "The driver is very shaken - it's very concerning."
Residents on Northland Road were allowed to return to their homes at about 03:30 GMT.
In County Antrim, residents also spent part of the night out of their homes in Portglenone, after a suspicious object was found on Main Street at 04:30 GMT.
Police said the alert was a hoax.