A network storage device including a storage unit for storing data, comprising: a first communication unit which includes a first network interface; a second communication unit which includes a second network interface; a relay unit which relays communication between an external device connected through the first network interface and an external device connected through the second network interface; a detecting unit which detects a power-on state of the external device connected through the first network interface; an operation control unit which, when a trigger to power off the network storage device is generated, keeps the first communication unit operating if the detecting unit detects the power-on state of the external device; characterized by: a setting holding unit which is configured as a storage unit to hold setting data representing whether the relay unit is to operate, wherein the relay unit determines whether to perform a relaying operation based on the setting data held in the setting holding unit, and the operation control unit is configured to, when the trigger to power off the network storage device is generated, keep the first and second communication units (54a, 54b) and the relay unit operating if the detecting unit detects the power-on state of the external device connected through the first network interface and the setting holding unit holds setting data representing that the relay unit is to operate, and the operation control unit is configured to, when the trigger to power off the network storage device is generated, power off the network storage device if the setting holding unit holds setting data representing that the relay unit is not to operate even when the detecting unit detects the power-on state of the external device connected through the first network interface. a first communication unit which includes a first network interface; a second communication unit which includes a second network interface; a relay unit which relays communication between an external device connected through the first network interface and an external device connected through the second network interface; a detecting unit which detects a power-on state of the external device connected through the first network interface; an operation control unit which, when a trigger to power off the network storage device is generated, keeps the first communication unit operating if the detecting unit detects the power-on state of the external device; characterized by: a setting holding unit which is configured as a storage unit to hold setting data representing whether the relay unit is to operate, wherein the relay unit determines whether to perform a relaying operation based on the setting data held in the setting holding unit, and the operation control unit is configured to, when the trigger to power off the network storage device is generated, keep the first and second communication units (54a, 54b) and the relay unit operating if the detecting unit detects the power-on state of the external device connected through the first network interface and the setting holding unit holds setting data representing that the relay unit is to operate, and a setting holding unit which is configured as a storage unit to hold setting data representing whether the relay unit is to operate, wherein the relay unit determines whether to perform a relaying operation based on the setting data held in the setting holding unit, and the operation control unit is configured to, when the trigger to power off the network storage device is generated, keep the first and second communication units (54a, 54b) and the relay unit operating if the detecting unit detects the power-on state of the external device connected through the first network interface and the setting holding unit holds setting data representing that the relay unit is to operate, and the operation control unit is configured to, when the trigger to power off the network storage device is generated, power off the network storage device if the setting holding unit holds setting data representing that the relay unit is not to operate even when the detecting unit detects the power-on state of the external device connected through the first network interface.