2N4401 NPN transistor gets closed by 12v

I got a 2N4401 NPN transistor which I want to control a LED with.
The working hookup I've tested looks like this:

Collector -> Ground 
Base -> 1k resistor -> Switch -> 5v+ 
Emitter -> LED cathode 
LED anode -> 1k resistor -> 5v+

When the switch to Base is open the LED isn't lit up but when I close the switch to Base the LED lights up, just as it's supposed to.

But when I do hook it up with 12v as below the transistor doesn't work as it's supposed to.

Collector -> Ground 
Base -> 1k resistor -> Switch -> 5v+ 
Emitter -> LED cathode 
LED anode -> 1k resistor -> 12v+

When it's hooked up like this the LED is lit up even if the switch to Base is open and when I close the switch to Base the LED gets a little brighter.

Am I hooking up the transistor wrong or is the transistor too weak?

If you connect emitter to ground and
Collector to LED CATODE it will work better.
Perhaps you also need a resistor (10 - 100 kohms) between base and emitter

Pelle

You sure it's npn and not pnp?

Npn is gnd to emitter to sink. To source you place positive to the collector then to your led via emitter but keep an eye on it's base voltage, I prefer pnp to source and npn to sink.

No, it's not PNP
http://www.onsemi.com/pub_link/Collateral/2N4401-D.PDF

The reverse voltage emitter to base should not be more than 6 volts
When connect to 12 V the leakcurrent become so great the transistor gets on.

A transistor works with emitter and collector reversed but only with low voltage and low hFE.

Pelle

The easiest way to destroy an NPN transistor is bring the emitter more positive than
the base as you may have done. You should suspect the device is damaged.

The recap (this information is everywhere on the net):

emitter to ground.
collector to LED cathode, LED anode to resistor, resistor to +12V
base via 1k resistor to control pin or switch.

i.e. like this but with 12V supply.

If that doesn't work you've fried the device - test with a mechanical
switch not an Arduino pin at first, because if the device is fried the collector
may be shorted to the base.