diff --git a/src/plugins/projectexplorer/ProjectExplorer.pluginspec b/src/plugins/projectexplorer/ProjectExplorer.pluginspec
index 394551f10292960e902758f5b8c8f46ce2d13599..e7395f77f62d2047aeb3443caf1c996b6b7eec7f 100644
--- a/src/plugins/projectexplorer/ProjectExplorer.pluginspec
+++ b/src/plugins/projectexplorer/ProjectExplorer.pluginspec
@@ -21,5 +21,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
     </dependencyList>
     <argumentList>
         <argument name="-customwizard-verbose">Verbose loading of custom wizards</argument>
+        <argument name="-lastsession">Restore the last session</argument>
     </argumentList>
 </plugin>
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index bb552c765a4e0882768ab1e55cee53cd4bfe413a..ff8ac82dcea6f1d1e6485c9c5291fee2fc21aa11 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -260,6 +260,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
 
     d->m_session = new SessionManager(this);
 
+    if (arguments.contains("-lastsession"))
+        d->m_sessionToRestoreAtStartup = d->m_session->lastSession();
+
     connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project *)),
             this, SIGNAL(fileListChanged()));
     connect(d->m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)),
@@ -1195,7 +1198,6 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
     // We have command line arguments, try to find a session in them
     QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments();
     // Default to no session loading
-    d->m_sessionToRestoreAtStartup.clear();
     foreach (const QString &arg, arguments) {
         if (sessions.contains(arg)) {
             // Session argument
@@ -1203,6 +1205,7 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
             break;
         }
     }
+
     if (!d->m_sessionToRestoreAtStartup.isNull())
         Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_EDIT);
 }