diff --git a/src/srun/libsrun/opt.c b/src/srun/libsrun/opt.c
index cb070962c7b13da94865804cc18eaef222b711d1..c27dae124cd38bd98e2335e3a09d3d426ae88f7a 100644
--- a/src/srun/libsrun/opt.c
+++ b/src/srun/libsrun/opt.c
@@ -1652,10 +1652,11 @@ static void _set_options(const int argc, char **argv)
 		}
 	}
 
-	/* This means it was read from the environment.  We will
-	 * override it with what the user specified in the hostlist.
-	 */
-	if (!ntasks_set_opt && (opt.distribution == SLURM_DIST_ARBITRARY))
+	/* This means --ntasks was read from the environment.  We will override
+	 * it with what the user specified in the hostlist. POE launched
+	 * jobs excluded (they have the SLURM_STARTED_STEP env var set). */
+	if (!ntasks_set_opt && (opt.distribution == SLURM_DIST_ARBITRARY) &&
+	    !getenv("SLURM_STARTED_STEP"))
 		opt.ntasks_set = false;
 
 	spank_option_table_destroy (optz);