A Liberty Cab driver was struck in the head with a long gun by a man who robbed him of $300 and a cellphone, Ferry-Fillmore District police said today.

The cabbie said he picked up three young men on Ericson Avenue just before 5 a.m., and drove them to an address on Emslie Street.

One of the three exited the cab, then pulled out a long gun and struck the driver in the head before robbing him. All three then fled on foot. The cabbie had to drive home to report the crime, police said.