An electronic key for a vehicle comprises a motion sensor configured to detect a movement of the electronic key; a processing unit; and a transceiver unit configured to transmit signals to and receive signals from the vehicle; wherein, upon receiving a first message from the vehicle that includes at least one of information that at least one door of the vehicle is open, and that a request to lock the vehicle has been received, the electronic key is further configured to detect whether the electronic key is moving, if no movement of the electronic key has been detected, the electronic key is configured to: send a response message to the vehicle that includes information concerning the non-movement of the electronic key, start a timer, and wait for a second message from the vehicle, the second message including information that the electronic key has been detected inside or outside the vehicle, wherein the electronic key is configured to stop the timer if a second message has been received before the timer has elapsed; and subsequently the processing unit is configured to, if the electronic key is detected to be inside the vehicle, keep the transceiver unit in the enabled state; and if the electronic key is detected to be outside the vehicle, switch the transceiver unit from an enabled state to a disabled state such that no signals may be received from the vehicle, and wherein the electronic key is further configured to stop the timer if the timer has elapsed without receiving the second message; and subsequently the processing unit is further configured to, switch the transceiver unit from an enabled state to a disabled state such that no signals may be received from the vehicle. a motion sensor configured to detect a movement of the electronic key; a processing unit; and a transceiver unit configured to transmit signals to and receive signals from the vehicle; wherein, upon receiving a first message from the vehicle that includes at least one of information that at least one door of the vehicle is open, and that a request to lock the vehicle has been received, the electronic key is further configured to detect whether the electronic key is moving, if no movement of the electronic key has been detected, the electronic key is configured to: send a response message to the vehicle that includes information concerning the non-movement of the electronic key, start a timer, and wait for a second message from the vehicle, the second message including information that the electronic key has been detected inside or outside the vehicle, wherein the electronic key is configured to stop the timer if a second message has been received before the timer has elapsed; and subsequently the processing unit is configured to, if the electronic key is detected to be inside the vehicle, keep the transceiver unit in the enabled state; and if the electronic key is detected to be outside the vehicle, switch the transceiver unit from an enabled state to a disabled state such that no signals may be received from the vehicle, and and subsequently the processing unit is configured to, if the electronic key is detected to be inside the vehicle, keep the transceiver unit in the enabled state; and if the electronic key is detected to be outside the vehicle, switch the transceiver unit from an enabled state to a disabled state such that no signals may be received from the vehicle, and wherein the electronic key is further configured to stop the timer if the timer has elapsed without receiving the second message; and subsequently the processing unit is further configured to, switch the transceiver unit from an enabled state to a disabled state such that no signals may be received from the vehicle. stop the timer if the timer has elapsed without receiving the second message; and subsequently the processing unit is further configured to, switch the transceiver unit from an enabled state to a disabled state such that no signals may be received from the vehicle.